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
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 envOutputWhat did you do?
I use
go:embedto embed a single file as string. The program prints file content and exits. I have an entry inoverlay.jsonwith the path of the file being embedded as a key pointing to another file. I passoverlay.jsontogo buildvia-overlayoption. 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