Skip to content

embed: failed to build source file contains string "/*" #43373

Closed
@zhuah

Description

@zhuah

What version of Go are you using (go version)?

$ go version
go version devel +b116404444 Wed Dec 23 17:31:18 2020 +0000 darwin/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/zhuah/Library/Caches/go-build"
GOENV="/Users/zhuah/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/zhuah/go/pkg/mod"
GOOS="darwin"
GOPATH="/Users/zhuah/go"
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/Cellar/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/gotip/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="devel +b116404444 Wed Dec 23 17:31:18 2020 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/zhuah/Projects/playground/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8n/mb3y_4bj1xv4q9sdmgjqdx_c0000gn/T/go-build314626058=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

sample code here:

package main

import (
	_ "embed"
	"strings"
)

var s = strings.ToUpper("test/*")

//go:embed main.go
var content string

func main() {
	_ = content
}

when i build it, the compile print errors:

# github.com/playground/embedtest
./main.go:10:3: invalid go:embed: build system did not supply embed configuration

if i comment var s = strings.ToUpper("test/*") or replace /* with any other strings, the compilation succeed.

What did you expect to see?

What did you see instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions