build: Warn when being executed outside of gopath
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4425
This commit is contained in:
parent
55b63941b8
commit
d84b6bb822
9
build.go
9
build.go
@ -204,7 +204,7 @@ func main() {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if gopath() == "" {
|
if gopath := gopath(); gopath == "" {
|
||||||
gopath, err := temporaryBuildDir()
|
gopath, err := temporaryBuildDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -217,6 +217,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
os.Setenv("GOPATH", gopath)
|
os.Setenv("GOPATH", gopath)
|
||||||
log.Println("GOPATH is", gopath)
|
log.Println("GOPATH is", gopath)
|
||||||
|
} else {
|
||||||
|
gopath, _ = filepath.EvalSymlinks(gopath)
|
||||||
|
wd, _ := os.Getwd()
|
||||||
|
wd, _ = filepath.EvalSymlinks(wd)
|
||||||
|
if filepath.Join(gopath, "src/github.com/syncthing/syncthing") != wd {
|
||||||
|
fmt.Println("You are running this outside of GOPATH/src/github.com/syncthing/syncthing, this might cause failure!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set path to $GOPATH/bin:$PATH so that we can for sure find tools we
|
// Set path to $GOPATH/bin:$PATH so that we can for sure find tools we
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user