-
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.18 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/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"
What did you do?
Moved into an empty directory, ran go mod init example and then ran this program:
package main
import (
"fmt"
"runtime/debug"
)
func main() {
info, available := debug.ReadBuildInfo()
fmt.Printf("%v %#v\n", available, info)
}What did you expect to see?
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"}}}
What did you see instead?
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
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.