-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
What version of Go are you using (go version)?
$ go version go version go1.18beta2 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/james/Library/Caches/go-build" GOENV="/Users/james/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/james/go/pkg/mod" GOOS="darwin" GOPATH="/Users/james/go" GOPROXY="direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.18beta2" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/james/projects/debug-module-version-demo/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/g1/r_29t6g17l926yzy2610sy3m0000gn/T/go-build2749357119=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Produce a binary with go build and with go install:
- Fetch the demo repo from @mark-rushakoff :
git clone https://github.com/mark-rushakoff/debug-module-version-demo.git go installgo build -o demo.osx *.go
Compare the attached build info:
Output from go build
$ go version -m demo.osx
demo.osx: go1.18beta2
path command-line-arguments
dep golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8=
dep rsc.io/quote v1.5.2 h1:w5fcysjrx7yqtD/aO+QwRjYZOKnaM9Uh2b40tElTs3Y=
dep rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=
build -compiler=gc
build CGO_ENABLED=1
build CGO_CFLAGS=
build CGO_CPPFLAGS=
build CGO_CXXFLAGS=
build CGO_LDFLAGS=
build GOARCH=amd64
build GOOS=darwin
build GOAMD64=v1Output from go install
$ go version -m /Users/james/go/bin/debug-module-version-demo
/Users/james/go/bin/debug-module-version-demo: go1.18beta2
path github.com/mark-rushakoff/debug-module-version-demo
mod github.com/mark-rushakoff/debug-module-version-demo (devel)
dep golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8=
dep rsc.io/quote v1.5.2 h1:w5fcysjrx7yqtD/aO+QwRjYZOKnaM9Uh2b40tElTs3Y=
dep rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=
build -compiler=gc
build CGO_ENABLED=1
build CGO_CFLAGS=
build CGO_CPPFLAGS=
build CGO_CXXFLAGS=
build CGO_LDFLAGS=
build GOARCH=amd64
build GOOS=darwin
build GOAMD64=v1
build vcs=git
build vcs.revision=f3f34e10b35e88a6f6998d8c1938a5998c33cb64
build vcs.time=2018-12-13T20:11:42Z
build vcs.modified=trueWhat did you expect to see?
I expected to see vcs.revision/vcs.modified/etc populated in the runtime/debug.ReadBuildInfo() of the binaries produced by go build -o demo.osx *.go and go install.
What did you see instead?
I saw vcs.revision/vcs.modified/etc populated only in the runtime/debug.ReadBuildInfo() of the binary produced by go install, but not the binary produced by go build -o demo.osx *.go.