Skip to content

Commit 9659c81

Browse files
authored
build: Fix shadowing bug in staleness calculation. (#635)
The parent scope pkg variable was inadvertently shadowed in #411. As a result, the value of impModeTime was wrong, and the if statement could never be true, and pkg.SrcModTime was never updated to a later time. Fixes #559 (possibly other similar issues, but they'll need to be verified).
1 parent 265040a commit 9659c81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,11 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
532532
if importedPkgPath == "unsafe" || ignored {
533533
continue
534534
}
535-
pkg, _, err := s.buildImportPathWithSrcDir(importedPkgPath, pkg.Dir)
535+
importedPkg, _, err := s.buildImportPathWithSrcDir(importedPkgPath, pkg.Dir)
536536
if err != nil {
537537
return nil, err
538538
}
539-
impModeTime := pkg.SrcModTime
539+
impModeTime := importedPkg.SrcModTime
540540
if impModeTime.After(pkg.SrcModTime) {
541541
pkg.SrcModTime = impModeTime
542542
}

0 commit comments

Comments
 (0)