]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/work: remove deps[1]="fmt" vet hack
authorAlan Donovan <adonovan@google.com>
Thu, 11 Sep 2025 17:40:24 +0000 (13:40 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 11 Sep 2025 19:37:57 +0000 (12:37 -0700)
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>

src/cmd/go/internal/work/action.go
src/cmd/go/internal/work/exec.go

index 2030f8cb040be96b7aaeae35f4a1d3a9943e23a6..bbd22458449de0063bc5d205bd80d536fc25ec73 100644 (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))
index a49268cba272d4768c4d1b27fe9b4469cfe3d98e..6e3ad00e0547c7bc7eb7782510ce82edafec328f 100644 (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