We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e53fd19 + 954f926 commit 84501b7Copy full SHA for 84501b7
1 file changed
pkg/loader/loader.go
@@ -243,6 +243,18 @@ func (l *loader) typeCheck(pkg *Package) {
243
244
// The imports map is keyed by import path.
245
importedPkg := pkg.Imports()[path]
246
+
247
+ // it's possible to have a call to check in parallel to a call to this
248
+ // if one package in the package graph gets its dependency filtered out,
249
+ // but another doesn't (so one wants a "dummy" package here, and another
250
+ // wants the full check).
251
+ //
252
+ // Thus, we need to lock here (at least for the time being) to avoid
253
+ // races between the above write to `pkg.Types` and this checking of
254
+ // importedPkg.Types.
255
+ importedPkg.Lock()
256
+ defer importedPkg.Unlock()
257
258
if importedPkg == nil {
259
return nil, fmt.Errorf("no package information for %q", path)
260
}
0 commit comments