Skip to content

cmd/go: missing result of ReadBuildInfo in init function #29628

Closed
@vearutop

Description

@vearutop

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

$ go1.12beta1 version
go version go1.12beta1 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
$ go1.12beta1 env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/viacheslav.poturaev/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/viacheslav.poturaev/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/viacheslav.poturaev/sdk/go1.12beta1"
GOTMPDIR=""
GOTOOLDIR="/Users/viacheslav.poturaev/sdk/go1.12beta1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lb/j0gz8jln36z4frqkrzmkdb0c0000gp/T/go-build125908091=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I've tried to read build info in app retrieved with go get:

GO111MODULE=on go1.12beta1 get github.com/vearutop/[email protected]
go: finding github.com/vearutop/go-versioning-example v0.0.1
go: finding go.uber.org/zap v1.3.0
go: finding go.uber.org/atomic v1.3.2

Then run ~/go/bin/go-versioning-example.
Here is a package to reproduce: https://github.com/vearutop/go-versioning-example

main package has two files: main.go and version.go. version.go has // +build go1.12 and init function that checks ReadBuildInfo.

What did you expect to see?

...some deps info...
2019-01-09T12:06:27.232+0100    INFO    [email protected]/main.go:9    App Version: v0.0.1

What did you see instead?

build info not available
2019-01-09T12:06:27.232+0100    INFO    [email protected]/main.go:9    App Version: dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions