testAddr2Line(t, exepath, syms[symName])
testAddr2Line(t, exepath, "0x"+syms[symName])
}
-
-func init() { testenv.SetModVendor() }
const detailOutput = false
-func init() { testenv.SetModVendor() }
-
// Compiles testfile checks that the description of lexical blocks emitted
// by the linker in debug_info, for each function in the main package,
// corresponds to what we expect it to be.
// We use TestMain to set up a temporary directory and remove it when
// the tests are done.
func TestMain(m *testing.M) {
- testenv.SetModVendor()
-
dir, err := ioutil.TempDir("", "gotestcover")
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
}
-func init() { testenv.SetModVendor() }
-
func TestDynlink(t *testing.T) {
testenv.MustHaveGoBuild(t)
"testing"
)
-func init() { testenv.SetModVendor() }
-
func TestUndefinedRelocErrors(t *testing.T) {
t.Parallel()
testenv.MustHaveGoBuild(t)
_ = AuthorPaidByTheColumnInch
}
-func init() { testenv.SetModVendor() }
-
func TestIssue21703(t *testing.T) {
t.Parallel()
return 0
}
- testenv.SetModVendor()
-
tmpDir, err := ioutil.TempDir("", "TestNM")
if err != nil {
fmt.Println("TempDir failed:", err)
if !testenv.HasGoBuild() {
return
}
- testenv.SetModVendor()
var exitcode int
if err := buildObjdump(); err == nil {
log.SetPrefix("vet/all: ")
log.SetFlags(log.Lshortfile)
- testenv.SetModVendor()
var err error
cmdGoPath, err = testenv.GoTool()
if err != nil {
}
func testMain(m *testing.M) int {
- testenv.SetModVendor()
-
dir, err := ioutil.TempDir("", "vet_test")
if err != nil {
fmt.Fprintln(os.Stderr, err)
// Can't check the signature here without a package cycle.
}
-func init() { testenv.SetModVendor() }
-
func TestImports(t *testing.T) {
testenv.MustHaveGoRun(t)
pclinetestBinary string
)
-func init() { testenv.SetModVendor() }
-
func dotest(t *testing.T) {
testenv.MustHaveGoBuild(t)
// For now, only works on amd64 platforms.
"testing"
)
-func init() { testenv.SetModVendor() }
-
func TestForCompiler(t *testing.T) {
testenv.MustHaveGoBuild(t)
"time"
)
-func init() { testenv.SetModVendor() }
-
const maxTime = 2 * time.Second
var importer = New(&build.Default, token.NewFileSet(), make(map[string]*types.Package))
"runtime"
"strconv"
"strings"
- "sync"
"testing"
)
}
}
-var modVendorOnce sync.Once
-
-// SetModVendor adds the "-mod=vendor" flag to the GOFLAGS environment variable.
-// This allows tests whose working directories are within the cmd and std
-// modules to run ``go'' commands without accessing the network to load
-// dependencies modules.
-//
-// SetModVendor must be called before any test may read the GOFLAGS environment
-// variable.
-//
-// TODO(golang.org/issue/30240): If we load go.mod files from vendor/
-// automatically, this will probably no longer be necessary.
-func SetModVendor() {
- modVendorOnce.Do(func() {
- var goflags []string
- for _, f := range strings.Fields(os.Getenv("GOFLAGS")) {
- if !strings.HasPrefix(f, "-mod=") && !strings.HasPrefix(f, "--mod=") {
- goflags = append(goflags, f)
- }
- }
- goflags = append(goflags, "-mod=vendor")
- os.Setenv("GOFLAGS", strings.Join(goflags, " "))
- })
-}
-
// GoToolPath reports the path to the Go tool.
// It is a convenience wrapper around GoTool.
// If the tool is unavailable GoToolPath calls t.Skip.
var toRemove []string
func TestMain(m *testing.M) {
- testenv.SetModVendor()
-
status := m.Run()
for _, file := range toRemove {
os.RemoveAll(file)
})
}
-func init() { testenv.SetModVendor() }
-
// TestMapping checkes the mapping section of CPU profiles
// has the HasFunctions field set correctly. If all PCs included
// in the samples are successfully symbolized, the corresponding