internal/packagesinternal: delete GoCmdRunner var (unused)

Change-Id: I1ddd0a28b97f0b70d18d0f188d77f1390c6bb291
Reviewed-on: https://go-review.googlesource.com/c/tools/+/540716
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Alan Donovan 2023-11-08 10:32:12 -05:00
Родитель 729e159c03
Коммит 13b2bd50ab
4 изменённых файлов: 2 добавлений и 22 удалений

Просмотреть файл

@ -432,12 +432,6 @@ func init() {
packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError {
return p.(*Package).depsErrors
}
packagesinternal.GetGoCmdRunner = func(config interface{}) *gocommand.Runner {
return config.(*Config).gocmdRunner
}
packagesinternal.SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) {
config.(*Config).gocmdRunner = runner
}
packagesinternal.SetModFile = func(config interface{}, value string) {
config.(*Config).modFile = value
}

Просмотреть файл

@ -14,7 +14,6 @@ import (
"strings"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/packagesinternal"
"golang.org/x/tools/internal/proxydir"
)
@ -171,8 +170,6 @@ func (modules) Finalize(exported *Exported) error {
"GOPROXY="+proxydir.ToURL(modProxyDir),
"GOSUMDB=off",
)
gocmdRunner := &gocommand.Runner{}
packagesinternal.SetGoCmdRunner(exported.Config, gocmdRunner)
// Run go mod download to recreate the mod cache dir with all the extra
// stuff in cache. All the files created by Export should be recreated.
@ -183,10 +180,8 @@ func (modules) Finalize(exported *Exported) error {
BuildFlags: exported.Config.BuildFlags,
WorkingDir: exported.Config.Dir,
}
if _, err := gocmdRunner.Run(context.Background(), inv); err != nil {
return err
}
return nil
_, err := new(gocommand.Runner).Run(context.Background(), inv)
return err
}
func writeModuleFiles(rootDir, module, ver string, filePaths map[string]string) error {

1
gopls/internal/lsp/cache/snapshot.go поставляемый
Просмотреть файл

@ -417,7 +417,6 @@ func (s *snapshot) config(ctx context.Context, inv *gocommand.Invocation) *packa
if typesinternal.SetUsesCgo(&types.Config{}) {
cfg.Mode |= packages.LoadMode(packagesinternal.TypecheckCgo)
}
packagesinternal.SetGoCmdRunner(cfg, s.view.gocmdRunner)
return cfg
}

Просмотреть файл

@ -5,10 +5,6 @@
// Package packagesinternal exposes internal-only fields from go/packages.
package packagesinternal
import (
"golang.org/x/tools/internal/gocommand"
)
var GetForTest = func(p interface{}) string { return "" }
var GetDepsErrors = func(p interface{}) []*PackageError { return nil }
@ -18,10 +14,6 @@ type PackageError struct {
Err string // the error itself
}
var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil }
var SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) {}
var TypecheckCgo int
var DepsErrors int // must be set as a LoadMode to call GetDepsErrors
var ForTest int // must be set as a LoadMode to call GetForTest