Browse Source

build: Handle split GOPATH

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4447
Simon Frei 8 years ago
parent
commit
46becc5338
1 changed files with 10 additions and 3 deletions
  1. 10 3
      build.go

+ 10 - 3
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.")
 		}
 	}