For a package that uses //go:embed but doesn't import "embed", cmd/compile correctly reports "go:embed only allowed in Go files that import "embed"" for -G=0 and GOEXPREIMENT=unified, but instead reports "invalid go:embed: build system did not supply embed configuration" for -G=3.
(The -G=3 error is technically correct here, because I'm not specifying the embed configuration either; but it's missing the important error.)
$ go tool compile -G=3 a.go
a.go:3:3: invalid go:embed: build system did not supply embed configuration
$ go tool compile -G=0 a.go
a.go:3:3: go:embed only allowed in Go files that import "embed"
$ GOEXPERIMENT=unified go tool compile a.go
a.go:3:3: go:embed only allowed in Go files that import "embed"
$ cat a.go
package p
//go:embed a.txt
var hi string
$ cat a.txt
hi
The text was updated successfully, but these errors were encountered:
For a package that uses
//go:embed
but doesn't import"embed"
, cmd/compile correctly reports "go:embed only allowed in Go files that import "embed"" for -G=0 and GOEXPREIMENT=unified, but instead reports "invalid go:embed: build system did not supply embed configuration" for -G=3.(The -G=3 error is technically correct here, because I'm not specifying the embed configuration either; but it's missing the important error.)
The text was updated successfully, but these errors were encountered: