build: Remove no longer used temporaryBuildDir (#7795)
This commit is contained in:
parent
445a82f120
commit
7a4c6d262f
27
build.go
27
build.go
|
@ -14,7 +14,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/flate"
|
"compress/flate"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"crypto/sha256"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
|
@ -1382,32 +1381,6 @@ func metalintShort() {
|
||||||
runPrint(goCmd, "test", "-short", "-run", "Metalint", "./meta")
|
runPrint(goCmd, "test", "-short", "-run", "Metalint", "./meta")
|
||||||
}
|
}
|
||||||
|
|
||||||
func temporaryBuildDir() (string, error) {
|
|
||||||
// The base of our temp dir is "syncthing-xxxxxxxx" where the x:es
|
|
||||||
// are eight bytes from the sha256 of our working directory. We do
|
|
||||||
// this because we want a name in the global temp dir that doesn't
|
|
||||||
// conflict with someone else building syncthing on the same
|
|
||||||
// machine, yet is persistent between runs from the same source
|
|
||||||
// directory.
|
|
||||||
wd, err := os.Getwd()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
hash := sha256.Sum256([]byte(wd))
|
|
||||||
base := fmt.Sprintf("syncthing-%x", hash[:4])
|
|
||||||
|
|
||||||
// The temp dir is taken from $STTMPDIR if set, otherwise the system
|
|
||||||
// default (potentially infrluenced by $TMPDIR on unixes).
|
|
||||||
var tmpDir string
|
|
||||||
if t := os.Getenv("STTMPDIR"); t != "" {
|
|
||||||
tmpDir = t
|
|
||||||
} else {
|
|
||||||
tmpDir = os.TempDir()
|
|
||||||
}
|
|
||||||
|
|
||||||
return filepath.Join(tmpDir, base), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t target) BinaryName() string {
|
func (t target) BinaryName() string {
|
||||||
if goos == "windows" {
|
if goos == "windows" {
|
||||||
return t.binaryName + ".exe"
|
return t.binaryName + ".exe"
|
||||||
|
|
Loading…
Reference in New Issue