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 https://github.com/syncthing/syncthing, 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 build.sh, I get these errors

GOPATH=/home/jmdavis/src/github.com/syncthing/Godeps/_workspace:/home/jmdavis/go:/usr/share/go/contrib 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 “github.com/syncthing/syncthing/internal/symlinks” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/symlinks (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/symlinks (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/symlinks /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/symlinks cmd/stfileinfo/main.go:25:2: cannot find package “github.com/syncthing/syncthing/internal/scanner” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/scanner (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/scanner (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/scanner /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/scanner cmd/stfinddevice/main.go:24:2: cannot find package “github.com/syncthing/syncthing/internal/discover” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/discover (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/discover (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/discover /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/discover cmd/stindex/main.go:25:2: cannot find package “github.com/syncthing/syncthing/internal/db” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/db (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/db (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/db /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/db cmd/syncthing/gui.go:36:2: cannot find package “github.com/syncthing/syncthing/internal/auto” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/auto (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/auto (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/auto /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/auto cmd/syncthing/gui.go:37:2: cannot find package “github.com/syncthing/syncthing/internal/config” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/config (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/config (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/config /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/config cmd/syncthing/gui.go:40:2: cannot find package “github.com/syncthing/syncthing/internal/events” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/events (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/events (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/events /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/events cmd/syncthing/gui.go:41:2: cannot find package “github.com/syncthing/syncthing/internal/model” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/model (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/model (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/model /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/model cmd/syncthing/gui.go:42:2: cannot find package “github.com/syncthing/syncthing/internal/osutil” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/osutil (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/osutil (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/osutil /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/osutil cmd/syncthing/gui.go:43:2: cannot find package “github.com/syncthing/syncthing/internal/upgrade” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/upgrade (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/upgrade (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/upgrade /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/upgrade cmd/syncthing/main.go:49:2: cannot find package “github.com/syncthing/syncthing/internal/upnp” in any of: /usr/lib64/go/src/pkg/github.com/syncthing/syncthing/internal/upnp (from $GOROOT) /home/jmdavis/src/github.com/syncthing/Godeps/_workspace/src/github.com/syncthing/syncthing/internal/upnp (from $GOPATH) /home/jmdavis/go/src/github.com/syncthing/syncthing/internal/upnp /usr/share/go/contrib/src/github.com/syncthing/syncthing/internal/upnp 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

/home/jmdavis/go:/usr/share/go/contrib

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

GOPATH=/home/jmdavis/src/github.com/syncthing/Godeps/_workspace:/home/jmdavis/go:/usr/share/go/contrib

I put the repo in ~/src/github.com/syncthing 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/github.com/ or ~/src/github.com/syncthing 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 http://golang.org/doc/install, 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/github.com/syncthing/syncthing/, 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.