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

cmd/go: -overlay doesn't apply to embed directives #59406

Open
mejedi opened this issue Apr 3, 2023 · 0 comments
Open

cmd/go: -overlay doesn't apply to embed directives #59406

mejedi opened this issue Apr 3, 2023 · 0 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mejedi
Copy link

mejedi commented Apr 3, 2023

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

$ go version
go version go1.20.2 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nickzavaritsky/Library/Caches/go-build"
GOENV="/Users/nickzavaritsky/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nickzavaritsky/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nickzavaritsky/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.20.2/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.20.2/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="cc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/Users/nickzavaritsky/EMnify/overlay_test/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/r9/l4zpd_011yv25z49q8wgddnm0000gp/T/go-build417032286=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I use go:embed to embed a single file as string. The program prints file content and exits. I have an entry in overlay.json with the path of the file being embedded as a key pointing to another file. I pass overlay.json to go build via -overlay option. Then I invoke the resulting binary.

What did you expect to see?

The content from the replacement file as specified via overlay.json.

What did you see instead?

The content from the original file.

The reproducer is available at https://github.com/mejedi/golang-overlay-experiment

@seankhliao seankhliao changed the title go:embed disregards -overlay settings of go build cmd/go: -overlay doesn't apply to embed directives Apr 3, 2023
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Apr 3, 2023
@bcmills bcmills added this to the Backlog milestone Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants