cmd/go/internal/work: remove deps[1]="fmt" vet hack

The Builder.vet operation has not needed an artificial
dependency on the fmt package since CL 176439 in 2019.
Remove it now.

Change-Id: I398a6d2d57175c12843520d9f19ffd023e676123
Reviewed-on: https://go-review.googlesource.com/c/go/+/702856
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Alan Donovan 2025-09-11 13:40:24 -04:00 committed by Gopher Robot
parent cf5e993177
commit 84e9ab3984
2 changed files with 4 additions and 15 deletions

View file

@ -716,25 +716,15 @@ func (b *Builder) vetAction(mode, depMode BuildMode, p *load.Package) *Action {
a := b.cacheAction("vet", p, func() *Action {
a1 := b.CompileAction(mode|ModeVetOnly, depMode, p)
// vet expects to be able to import "fmt".
var stk load.ImportStack
stk.Push(load.NewImportInfo("vet", nil))
p1, err := load.LoadImportWithFlags("fmt", p.Dir, p, &stk, nil, 0)
if err != nil {
base.Fatalf("unexpected error loading fmt package from package %s: %v", p.ImportPath, err)
}
stk.Pop()
aFmt := b.CompileAction(ModeBuild, depMode, p1)
var deps []*Action
if a1.buggyInstall {
// (*Builder).vet expects deps[0] to be the package
// and deps[1] to be "fmt". If we see buggyInstall
// (*Builder).vet expects deps[0] to be the package.
// If we see buggyInstall
// here then a1 is an install of a shared library,
// and the real package is a1.Deps[0].
deps = []*Action{a1.Deps[0], aFmt, a1}
deps = []*Action{a1.Deps[0], a1}
} else {
deps = []*Action{a1, aFmt}
deps = []*Action{a1}
}
for _, p1 := range p.Internal.Imports {
deps = append(deps, b.vetAction(mode, depMode, p1))

View file

@ -1306,7 +1306,6 @@ var VetExplicit bool
func (b *Builder) vet(ctx context.Context, a *Action) error {
// a.Deps[0] is the build of the package being vetted.
// a.Deps[1] is the build of the "fmt" package.
a.Failed = nil // vet of dependency may have failed but we can still succeed