We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
$ go version go version go1.18 darwin/amd64
Yes
go env
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/vearutop/Library/Caches/go-build" GOENV="/Users/vearutop/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/vearutop/go/pkg/mod" GONOPROXY="github.com/adjust,github.com/vearutop,github.com/Unbotify" GONOSUMDB="github.com/adjust,github.com/vearutop,github.com/Unbotify" GOOS="darwin" GOPATH="/Users/vearutop/go" GOPRIVATE="github.com/adjust,github.com/vearutop,github.com/Unbotify" GOPROXY="https://proxy.golang.org,direct" GOROOT="/Users/vearutop/sdk/go1.18" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/vearutop/sdk/go1.18/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.18" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/vearutop/dev/temp/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/n7/jv2b0zv57jzc8y6zhmfzbn7c0000gn/T/go-build2483865593=/tmp/go-build -gno-record-gcc-switches -fno-common"
Moved into an empty directory, ran go mod init example and then ran this program:
go mod init example
package main import ( "fmt" "runtime/debug" ) func main() { info, available := debug.ReadBuildInfo() fmt.Printf("%v %#v\n", available, info) }
true &debug.BuildInfo{GoVersion:"go1.18", Path:"command-line-arguments", Main:debug.Module{Path:"example", Version:"(devel)", Sum:"", Replace:(*debug.Module)(nil)}, Deps:[]*debug.Module(nil), Settings:[]debug.BuildSetting{debug.BuildSetting{Key:"-compiler", Value:"gc"}, debug.BuildSetting{Key:"CGO_ENABLED", Value:"1"}, debug.BuildSetting{Key:"CGO_CFLAGS", Value:""}, debug.BuildSetting{Key:"CGO_CPPFLAGS", Value:""}, debug.BuildSetting{Key:"CGO_CXXFLAGS", Value:""}, debug.BuildSetting{Key:"CGO_LDFLAGS", Value:""}, debug.BuildSetting{Key:"GOARCH", Value:"amd64"}, debug.BuildSetting{Key:"GOOS", Value:"darwin"}, debug.BuildSetting{Key:"GOAMD64", Value:"v1"}}}
true &debug.BuildInfo{GoVersion:"go1.18", Path:"command-line-arguments", Main:debug.Module{Path:"", Version:"", Sum:"", Replace:(*debug.Module)(nil)}, Deps:[]*debug.Module(nil), Settings:[]debug.BuildSetting{debug.BuildSetting{Key:"-compiler", Value:"gc"}, debug.BuildSetting{Key:"CGO_ENABLED", Value:"1"}, debug.BuildSetting{Key:"CGO_CFLAGS", Value:""}, debug.BuildSetting{Key:"CGO_CPPFLAGS", Value:""}, debug.BuildSetting{Key:"CGO_CXXFLAGS", Value:""}, debug.BuildSetting{Key:"CGO_LDFLAGS", Value:""}, debug.BuildSetting{Key:"GOARCH", Value:"amd64"}, debug.BuildSetting{Key:"GOOS", Value:"darwin"}, debug.BuildSetting{Key:"GOAMD64", Value:"v1"}}}
go1.17 shows
go1.17
true &debug.BuildInfo{Path:"command-line-arguments", Main:debug.Module{Path:"example", Version:"(devel)", Sum:"", Replace:(*debug.Module)(nil)}, Deps:[]*debug.Module(nil)}
while go1.18 returns empty Path and Version for Main module.
go1.18
Path
Version
Main
The text was updated successfully, but these errors were encountered:
Duplicate of #51831
Sorry, something went wrong.
No branches or pull requests
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 env
OutputWhat did you do?
Moved into an empty directory, ran
go mod init example
and then ran this program:What did you expect to see?
What did you see instead?
go1.17
showswhile
go1.18
returns emptyPath
andVersion
forMain
module.The text was updated successfully, but these errors were encountered: