@@ -194,7 +194,7 @@ func (s *snapshot) buildKey(ctx context.Context, id PackageID, mode source.Parse
194
194
depKeys = append (depKeys , depHandle .key )
195
195
}
196
196
experimentalKey := s .View ().Options ().ExperimentalPackageCacheKey
197
- ph .key = checkPackageKey (ph .m .ID , compiledGoFiles , m . Config , depKeys , mode , experimentalKey )
197
+ ph .key = checkPackageKey (ph .m .ID , compiledGoFiles , m , depKeys , mode , experimentalKey )
198
198
return ph , deps , nil
199
199
}
200
200
@@ -214,15 +214,18 @@ func (s *snapshot) workspaceParseMode(id PackageID) source.ParseMode {
214
214
return source .ParseExported
215
215
}
216
216
217
- func checkPackageKey (id PackageID , pghs []* parseGoHandle , cfg * packages. Config , deps []packageHandleKey , mode source.ParseMode , experimentalKey bool ) packageHandleKey {
217
+ func checkPackageKey (id PackageID , pghs []* parseGoHandle , m * KnownMetadata , deps []packageHandleKey , mode source.ParseMode , experimentalKey bool ) packageHandleKey {
218
218
b := bytes .NewBuffer (nil )
219
219
b .WriteString (string (id ))
220
+ if m .Module != nil {
221
+ b .WriteString (m .Module .GoVersion ) // go version affects type check errors.
222
+ }
220
223
if ! experimentalKey {
221
224
// cfg was used to produce the other hashed inputs (package ID, parsed Go
222
225
// files, and deps). It should not otherwise affect the inputs to the type
223
226
// checker, so this experiment omits it. This should increase cache hits on
224
227
// the daemon as cfg contains the environment and working directory.
225
- b .WriteString (hashConfig (cfg ))
228
+ b .WriteString (hashConfig (m . Config ))
226
229
}
227
230
b .WriteByte (byte (mode ))
228
231
for _ , dep := range deps {
0 commit comments