Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Refactor to prefer defers for Close
  • Loading branch information
myitcv committed May 4, 2018
commit 9c06cba0629511fcdcc0131274e9a38be4adf622
4 changes: 2 additions & 2 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,10 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
if err != nil {
return nil, fmt.Errorf("could not open %v: %v", binPath, err)
}
defer binFile.Close()
if _, err := io.Copy(binHash, binFile); err != nil {
return nil, fmt.Errorf("failed to hash %v: %v", binPath, err)
}
binFile.Close()
fmt.Fprintf(hw, "gopherjs bin: %#x\n", binHash.Sum(nil))

orderedBuildTags := append([]string{}, s.options.BuildTags...)
Expand Down Expand Up @@ -714,9 +714,9 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
}
return nil, err
}
defer objFile.Close()

archive, err := compiler.ReadArchive(pkg.PkgObj, pkg.ImportPath, objFile, s.Types)
objFile.Close()
if err != nil {
return nil, err
}
Expand Down