diff options
author | qiulaidongfeng <2645477756@qq.com> | 2024-04-28 04:57:20 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-05-13 15:54:54 +0000 |
commit | f933f78d17dbfecacc2de97ccaef0e5815cfbb37 (patch) | |
tree | 06bb961c1529e38a90a488e748ad665502ee4983 /src/cmd/go/internal/load/pkg.go | |
parent | 9ea4770e144d27877e5fe7635b662d20f6b86a6b (diff) | |
download | go-f933f78d17dbfecacc2de97ccaef0e5815cfbb37.tar.gz go-f933f78d17dbfecacc2de97ccaef0e5815cfbb37.zip |
cmd/go: remove unused code
Change-Id: I39e8533a646d171a84c1ef307915286213006543
GitHub-Last-Rev: 3c21684ad071ecf6c4e4bf93128131a9cd0e587d
GitHub-Pull-Request: golang/go#67090
Reviewed-on: https://go-review.googlesource.com/c/go/+/581938
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/go/internal/load/pkg.go')
-rw-r--r-- | src/cmd/go/internal/load/pkg.go | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index f241e93ee8..58acd4dc34 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -604,51 +604,6 @@ func (sp *ImportStack) shorterThan(t []string) bool { // we return the same pointer each time. var packageCache = map[string]*Package{} -// ClearPackageCache clears the in-memory package cache and the preload caches. -// It is only for use by GOPATH-based "go get". -// TODO(jayconrod): When GOPATH-based "go get" is removed, delete this function. -func ClearPackageCache() { - clear(packageCache) - resolvedImportCache.Clear() - packageDataCache.Clear() -} - -// ClearPackageCachePartial clears packages with the given import paths from the -// in-memory package cache and the preload caches. It is only for use by -// GOPATH-based "go get". -// TODO(jayconrod): When GOPATH-based "go get" is removed, delete this function. -func ClearPackageCachePartial(args []string) { - shouldDelete := make(map[string]bool) - for _, arg := range args { - shouldDelete[arg] = true - if p := packageCache[arg]; p != nil { - delete(packageCache, arg) - } - } - resolvedImportCache.DeleteIf(func(key importSpec) bool { - return shouldDelete[key.path] - }) - packageDataCache.DeleteIf(func(key string) bool { - return shouldDelete[key] - }) -} - -// ReloadPackageNoFlags is like LoadImport but makes sure -// not to use the package cache. -// It is only for use by GOPATH-based "go get". -// TODO(rsc): When GOPATH-based "go get" is removed, delete this function. -func ReloadPackageNoFlags(arg string, stk *ImportStack) *Package { - p := packageCache[arg] - if p != nil { - delete(packageCache, arg) - resolvedImportCache.DeleteIf(func(key importSpec) bool { - return key.path == p.ImportPath - }) - packageDataCache.Delete(p.ImportPath) - } - return LoadPackage(context.TODO(), PackageOpts{}, arg, base.Cwd(), stk, nil, 0) -} - // dirToImportPath returns the pseudo-import path we use for a package // outside the Go path. It begins with _/ and then contains the full path // to the directory. If the package lives in c:\home\gopher\my\pkg then |