From: Russ Cox Date: Sat, 21 Jan 2012 04:35:28 +0000 (-0500) Subject: cmd/go: every test imports regexp X-Git-Tag: weekly.2012-01-27~124 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e56dc0ad37b2c736668b6069d3f39a3b5f309e87;p=gostls13.git cmd/go: every test imports regexp This fixes the bug Rob ran into when editing package bytes. Regexp imports regexp/syntax, which imports bytes, and regexp/syntax was not being properly recompiled during a test of a change to package bytes. R=golang-dev, r CC=golang-dev https://golang.org/cl/5555065 --- diff --git a/src/cmd/go/test.go b/src/cmd/go/test.go index fb222b139d..e28eaeffcb 100644 --- a/src/cmd/go/test.go +++ b/src/cmd/go/test.go @@ -406,6 +406,18 @@ func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, if pxtest != nil { pmain.imports = append(pmain.imports, pxtest) } + + // The generated main also imports testing and regexp. + ptesting, err := loadPackage("testing") + if err != nil { + return nil, nil, nil, err + } + pregexp, err := loadPackage("regexp") + if err != nil { + return nil, nil, nil, err + } + pmain.imports = append(pmain.imports, ptesting, pregexp) + a := b.action(modeBuild, modeBuild, pmain) a.objdir = testDir + string(filepath.Separator) a.objpkg = filepath.Join(testDir, "main.a")