mirror of
https://github.com/golang/go
synced 2024-11-17 16:04:47 -07:00
cmd/go: declare runtime/cgo dependency for darwin/arm, darwin/arm64 tests
I don't know why these tests must import runtime/cgo in _testmain.go, but if they must, they must also tell the rest of the go command that they are doing so. Should fix the newly-broken darwin/arm and darwin/arm64 builders. Change-Id: I9b183f8c84c6f403bf3a90cbfc838d6ef428e16f Reviewed-on: https://go-review.googlesource.com/67230 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
c56434f6a6
commit
1b873f5fd2
@ -885,10 +885,16 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
|
||||
},
|
||||
}
|
||||
|
||||
// The generated main also imports testing, regexp, and os.
|
||||
// The generated main also imports testing, regexp, os, and maybe runtime/cgo.
|
||||
stk.Push("testmain")
|
||||
forceCgo := false
|
||||
if cfg.BuildContext.GOOS == "darwin" {
|
||||
if cfg.BuildContext.GOARCH == "arm" || cfg.BuildContext.GOARCH == "arm64" {
|
||||
forceCgo = true
|
||||
}
|
||||
}
|
||||
deps := testMainDeps
|
||||
if cfg.ExternalLinkingForced() {
|
||||
if cfg.ExternalLinkingForced() || forceCgo {
|
||||
deps = str.StringList(deps, "runtime/cgo")
|
||||
}
|
||||
for _, dep := range deps {
|
||||
@ -950,11 +956,7 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
|
||||
recompileForTest(pmain, p, ptest, testDir)
|
||||
}
|
||||
|
||||
if cfg.BuildContext.GOOS == "darwin" {
|
||||
if cfg.BuildContext.GOARCH == "arm" || cfg.BuildContext.GOARCH == "arm64" {
|
||||
t.NeedCgo = true
|
||||
}
|
||||
}
|
||||
t.NeedCgo = forceCgo
|
||||
|
||||
for _, cp := range pmain.Internal.Imports {
|
||||
if len(cp.Internal.CoverVars) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user