blob: fbf097c0a6e6f91e9a94845d09b7df2bf8280d10 [file] [log] [blame] [edit]
# Ensure buildinfo is populated on test binaries even if they
# are not tests for package main. See issue #33976.
[short] skip 'invokes go test'
go mod init foo
go test -v
stdout '(devel)'
-- foo_test.go --
package foo_test
import (
"runtime/debug"
"testing"
)
func TestBuildInfo(t *testing.T) {
info, ok := debug.ReadBuildInfo()
if !ok {
t.Fatal("no debug info")
}
t.Log(info.Main.Version)
}