remove two misguided TODOs

The way computePkgCache caches per-package results in GARBLE_CACHE,
under normal circumstances where a user isn't deleting GARBLE_CACHE
we will only load gob files for direct imports, not indirect ones.
Hence, loading a package's gob file twice is not happening normally.

And the way we use go/types, we don't need to set Config.GoVersion.
pull/949/head
Daniel Martí 6 months ago committed by Paul Scheduikat
parent 9cf2a6a77f
commit 6dca875017

@ -1455,10 +1455,6 @@ func computePkgCache(fsCache *cache.Cache, lpkg *listedPackage, pkg *types.Packa
// Note that practically all errors from Cache.GetFile are a cache miss; // Note that practically all errors from Cache.GetFile are a cache miss;
// for example, a file might exist but be empty if another process // for example, a file might exist but be empty if another process
// is filling the same cache entry concurrently. // is filling the same cache entry concurrently.
//
// TODO: if A (curPkg) imports B and C, and B also imports C,
// then loading the gob files from both B and C is unnecessary;
// loading B's gob file would be enough. Is there an easy way to do that?
computed := pkgCache{ computed := pkgCache{
ReflectAPIs: map[funcFullName]map[int]bool{ ReflectAPIs: map[funcFullName]map[int]bool{
"reflect.TypeOf": {0: true}, "reflect.TypeOf": {0: true},
@ -1643,8 +1639,9 @@ func typecheck(pkgPath string, files []*ast.File, origImporter importerWithMap)
Selections: make(map[*ast.SelectorExpr]*types.Selection), Selections: make(map[*ast.SelectorExpr]*types.Selection),
Instances: make(map[*ast.Ident]types.Instance), Instances: make(map[*ast.Ident]types.Instance),
} }
// TODO(mvdan): we should probably set types.Config.GoVersion from go.mod
origTypesConfig := types.Config{ origTypesConfig := types.Config{
// Note that we don't set GoVersion here. Any Go language version checks
// are performed by the upfront `go list -json -compiled` call.
Importer: origImporter, Importer: origImporter,
Sizes: types.SizesFor("gc", sharedCache.GoEnv.GOARCH), Sizes: types.SizesFor("gc", sharedCache.GoEnv.GOARCH),
} }

Loading…
Cancel
Save