@@ -25,8 +25,11 @@ const (
2525 HashModeNeedAllDeps
2626)
2727
28- // Cache is a per-package data cache. A cached data is invalidated when
29- // package, or it's dependencies change.
28+ var ErrMissing = errors .New ("missing data" )
29+
30+ // Cache is a per-package data cache.
31+ // A cached data is invalidated when package,
32+ // or it's dependencies change.
3033type Cache struct {
3134 lowLevelCache cache.Cache
3235 pkgHashes sync.Map
@@ -90,8 +93,6 @@ func (c *Cache) Put(pkg *packages.Package, mode HashMode, key string, data any)
9093 return nil
9194}
9295
93- var ErrMissing = errors .New ("missing data" )
94-
9596func (c * Cache ) Get (pkg * packages.Package , mode HashMode , key string , data any ) error {
9697 var aID cache.ActionID
9798 var err error
@@ -148,9 +149,9 @@ func (c *Cache) pkgActionID(pkg *packages.Package, mode HashMode) (cache.ActionI
148149 return key .Sum (), nil
149150}
150151
151- // packageHash computes a package's hash. The hash is based on all Go
152- // files that make up the package, as well as the hashes of imported
153- // packages.
152+ // packageHash computes a package's hash.
153+ // The hash is based on all Go files that make up the package,
154+ // as well as the hashes of imported packages.
154155func (c * Cache ) packageHash (pkg * packages.Package , mode HashMode ) (string , error ) {
155156 type hashResults map [HashMode ]string
156157 hashResI , ok := c .pkgHashes .Load (pkg )
0 commit comments