Our build script

Our build script (build.go and .sh wrapper) has a couple of “modes” when building;

  • “build” which ends up as “go build …” and binaries in .
  • “install” which ends up “go install …” and binaries in bin

These are for historical reasons from when GOPATH was the thing and build caching didn’t work like it does now. The build mode works with cross compilation, install doesn’t.

There are then “targets”:

  • “all” which is all the things in ./cmd/...
  • “syncthing” which is ./cmd/syncthing specifically
  • a couple of others for stdiscosrv etc

The default when you just go run build.go is equivalent to install all – all the binaries are built and put in bin/.

Most people probably don’t want or need all the binaries. It also fails with -no-upgrade because not all binaries can be built without the upgrade stuff.

Can we change the default to the equivalent of install syncthing instead, building just that binary by default?

And/or, in the long run, remove the build vs install difference and just always produce binaries using go build? (We might need to keep the difference between where the binaries end up, lest we screw over packagers unnecessarily… Or we have a flag day and say “binaries are always in bin now”, I don’t know.)

3 Likes