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

Skip to content
Prev Previous commit
Next Next commit
Add build tags to the hash
  • Loading branch information
myitcv committed May 4, 2018
commit 69257f7911f57e59bffcef11880ca9b00cedba7b
6 changes: 6 additions & 0 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"path"
"path/filepath"
"runtime"
"sort"
"strconv"
"strings"

Expand Down Expand Up @@ -610,6 +611,11 @@ func (s *Session) BuildPackage(pkg *PackageData) (*compiler.Archive, error) {
defer binFile.Close()
io.Copy(pkgHash, binFile)

orderedBuildTags := append([]string{}, s.options.BuildTags...)
sort.Strings(orderedBuildTags)

fmt.Fprintf(pkgHash, "build tags: %v\n", strings.Join(orderedBuildTags, ","))

for _, importedPkgPath := range pkg.Imports {
// Ignore all imports that aren't mentioned in import specs of pkg.
// For example, this ignores imports such as runtime/internal/sys and runtime/internal/atomic.
Expand Down