Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zhuah opened this issue Dec 25, 2020 · 3 comments
Closed

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

zhuah opened this issue Dec 25, 2020 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@zhuah
Copy link

zhuah commented Dec 25, 2020

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?

@seankhliao
Copy link
Member

I don't think it's just the presence of /*, it's also where it is. The following errors:

package main

import _ "embed"

var s = "/*"

//go:embed main.go
var content string

func main() {}

But this works:

package main

import _ "embed"

//go:embed main.go
var content string

var s = "/*"

func main() {}

@gopherbot
Copy link

Change https://golang.org/cl/280332 mentions this issue: go/build: skip string while findEmbed

@mdempsky mdempsky added this to the Go1.16 milestone Dec 29, 2020
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 30, 2020
@toothrot
Copy link
Contributor

toothrot commented Jan 7, 2021

@rsc Can you take a look at https://golang.org/cl/280332?

@golang golang locked and limited conversation to collaborators Jan 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

6 participants