Source file src/cmd/go/internal/test/analysis.go
1 // Copyright 2026 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package test 6 7 // This file defines go test's use of an analysis driver with a 8 // dynamically built tool in place of cmd/vet (GOEXPERIMENT=vetfiles; 9 // see go.dev/issue/82464). For now, its functions are no-op stubs. 10 11 import ( 12 "context" 13 14 "cmd/go/internal/base" 15 "cmd/go/internal/load" 16 "cmd/go/internal/modload" 17 "cmd/go/internal/work" 18 ) 19 20 // addTestAnalysis adds the actions to analyze package p, in place of 21 // cmd/vet (see addTestVet). The test's run action and the install 22 // action, if any, depend on the analysis. 23 func addTestAnalysis(ld *modload.Loader, b *work.Builder, p *load.Package, runAction, installAction *work.Action) { 24 // TODO(adonovan): implement. 25 base.Fatalf("GOEXPERIMENT=vetfiles not yet implemented") 26 } 27 28 // buildAnalysisTool adds the actions to build the analysis tool and 29 // query its metadata, if any packages need it. 30 func buildAnalysisTool(ld *modload.Loader, ctx context.Context, b *work.Builder, opts load.PackageOpts) { 31 // TODO(adonovan): implement. 32 base.Fatalf("GOEXPERIMENT=vetfiles not yet implemented") 33 } 34 35 // runAnalysisToolChild is the main function of a child go test 36 // command that builds the analysis tool on behalf of its parent. 37 // It returns true to override the usual behavior of go test. 38 func runAnalysisToolChild(ctx context.Context, ld *modload.Loader) bool { 39 // TODO(adonovan): implement. 40 return false 41 } 42