From 46becc5338c7939866df2253674d1726488ecc23 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Sat, 21 Oct 2017 17:37:06 +0000 Subject: [PATCH] build: Handle split GOPATH GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4447 --- build.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build.go b/build.go index 8bd2fa678..3744feb1c 100644 --- a/build.go +++ b/build.go @@ -218,11 +218,18 @@ func main() { os.Setenv("GOPATH", gopath) log.Println("GOPATH is", gopath) } else { - gopath, _ = filepath.EvalSymlinks(gopath) + inside := false 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!") + for _, p := range filepath.SplitList(gopath) { + p, _ = filepath.EvalSymlinks(p) + if filepath.Join(p, "src/github.com/syncthing/syncthing") == wd { + inside = true + break + } + } + if !inside { + fmt.Println("You seem to have GOPATH set but the Syncthing source not placed correctly within it, which may cause problems.") } }