Build instructions on github seem to be incomplete - lots of error messages

I’m trying to build syncthing on my linux box (currently OpenSuSE), and I’ve followed the instructions on git clone, but clearly, they’re not enough, because I get a wall of error messages when I follow them. In particular, when I run either go run build.go or, I get these errors

GOPATH=/home/jmdavis/src/ go install -v -ldflags -w -X main.Version v0.10.22 -X main.BuildStamp 1423519411 -X main.BuildUser jmdavis -X main.BuildHost Lyonel -X main.BuildEnv default ./cmd/… cmd/stcompdirs/main.go:28:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/stfileinfo/main.go:25:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/stfinddevice/main.go:24:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/stindex/main.go:25:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/syncthing/gui.go:36:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/syncthing/gui.go:37:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/syncthing/gui.go:40:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/syncthing/gui.go:41:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/syncthing/gui.go:42:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/syncthing/gui.go:43:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ cmd/syncthing/main.go:49:2: cannot find package “” in any of: /usr/lib64/go/src/pkg/ (from $GOROOT) /home/jmdavis/src/ (from $GOPATH) /home/jmdavis/go/src/ /usr/share/go/contrib/src/ exit status 1 exit status 1

From the looks of it, it’s complaining about not finding packages which are within the syncthing repo, which strikes me as very odd. But I’ve never used go, and I’m not at all familiar with how its build system works. So, while there may be a simple and easy solution to this, I haven’t a clue what to do. Any help would be appreciated.

When I run go version, it prints

go version go1.3.3 linux/amd64

My guess is that there’s something that’s normally present on the machine of someone who actually uses go that I’m missing, but I really don’t know.

You need to setup your go path correctly, nothing wrong with the build system. The checkout is suposed to be on go path (with the right set of directories before the checkout)

Also you need go 1.4 ideally.

What is my GOPATH supposed to look like then? By default, it seems to be


but when I run or go run build.go, it prints out


I put the repo in ~/src/ as requested by the build documentation, and the only thing that it says about GOPATH is to export GOPATH=~. But all that that changes is that /usr/share/go/contrib is no longer part of GOPATH. The build fails the same way regardless.

And trying to put either ~/src/ or ~/src/ on either end of GOPATH seems to have no effect.

I’m using the go package from one of the opensuse repos, so maybe they did something odd with the installation, but looking at, I don’t see anything there about setting GOPATH. That documentation pretty much seems to amount to just putting the go binary in /usr/local/bin or somewhere else on your PATH. So, I don’t see any configuration steps that I might be missing, and if there’s something specific that I need to put on the GOPATH, I don’t know what it would be, since nothing that I’ve tried has worked. Regardless, if there’s something more that needs to be done to the GOPATH, it should be in the build docs, and it’s not.

What are the errors when you set your GOPATH to ~. ? Alternatively, you can move the whole src directory from ~. to ~/go/ as that seems to be on your path already.

Oh drat. I missed one level in the directory hierarchy. I had ~/src/github/syncthing/, when I needed to have ~/src/github/syncthing/syncthing/. If I get that right and then either put ~ in my GOPATH or use /home/jmdavis/go/src/, then it works. The syncthing directory within a syncthing directory threw me off. Sorry for the trouble.

I must say though that it’s rather annoying that go is so picky about paths instead of being able to just build in place like the programs in most other languages can. Too bad that that’s the case, though I guess that anyone who likes go probably considers it a small price to pay.