Debian Codegraph @

src/cmd/go/testdata/script/test_buildinfo.txt

raw
1 # Ensure buildinfo is populated on test binaries even if they
2 # are not tests for package main. See issue #33976.
3
4 [short] skip 'invokes go test'
5
6 go mod init foo
7 go test -v
8 stdout '(devel)'
9
10 -- foo_test.go --
11 package foo_test
12
13 import (
14 "runtime/debug"
15 "testing"
16 )
17
18 func TestBuildInfo(t *testing.T) {
19 info, ok := debug.ReadBuildInfo()
20 if !ok {
21 t.Fatal("no debug info")
22 }
23 t.Log(info.Main.Version)
24 }