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

Skip to content
Prev Previous commit
Next Next commit
More readable version of hash for debug purposes
  • Loading branch information
myitcv committed May 4, 2018
commit f6baa109ae44fec7040539794cdd6737f90ba397
7 changes: 5 additions & 2 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,10 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
return nil, fmt.Errorf("could not open %v: %v", binPath, err)
}
defer binFile.Close()
io.Copy(pkgHash, binFile)

binHash := sha256.New()
io.Copy(binHash, binFile)
fmt.Fprintf(pkgHash, "gopherjs bin: %#x\n", binHash.Sum(nil))

orderedBuildTags := append([]string{}, s.options.BuildTags...)
sort.Strings(orderedBuildTags)
Expand Down Expand Up @@ -642,7 +645,7 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
}

fmt.Fprintf(pkgHash, "import: %v\n", importedPkgPath)
fmt.Fprintf(pkgHash, " hash: %v\n", importedArchive.Hash)
fmt.Fprintf(pkgHash, " hash: %#x\n", importedArchive.Hash)
}

for _, name := range append(pkg.GoFiles, pkg.JSFiles...) {
Expand Down