cmd/go: embed directive doesn't work in file with leading bom #46198
Labels
FrozenDueToAge
GoCommand
cmd/go
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
embed file in win,linux
What did you expect to see?
abcd1111
What did you see instead?
invalid go:embed: build system did not supply embed configuration
go source file allows utf8 with bom, all my go source code is in this format. It works well until it hits go://embed!
This problem has bothered me for a month. I was discussing it in the Golang Technology Park in China,
and @del-xiong discovered the problem. Thanks him! ! !
Golang version with bug:
go version go1.16.4 windows/amd64
go version go1.16.3 windows/amd64
go version go1.16.3 linux/amd64
golang source code:
error message:
xxx.go:8:3: invalid go:embed: build system did not supply embed configuration
how to let problem gone
Currently,
change xxx.go source file format,from utf8withbom ,to utf8nobom,
line end is CRLF no need change.
h1.txt content:
abcd1111
The text was updated successfully, but these errors were encountered: