This may be an inane suggestion, but have you considered using a build container and corresponding Makefile? This would provide build consistency. Could look like:
PROJECT := github.com/dgraph-io/dgraph
# docker tag is DGRAPH_VERSION unless DGRAPH_VERSION is set
DGRAPH_VERSION := $(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GITUNTRACKEDCHANGES := $(shell git status --porcelain --untracked-files=no)
ifneq ($(GITUNTRACKEDCHANGES),)
GITCOMMIT := $(DGRAPH_VERSION)-dirty
endif
all: clean fat build
clean:
rm -fr target bin pkg
build:
docker run \
-v `pwd`:/gopath/src/$(PROJECT) \
quay.io/dgraph-io/build-go:16
docker build -t quay.io/dgraph-io/dgraph:${DGRAPH_VERSION} .
docker-push:
docker push quay.io/dgraph-io/dgraph:${DGRAPH_VERSION}
fmt:
@gofmt -w .
.PHONY: clean all
.PHONY: $(BINARIES)
.PHONY: $(CMDS)
Edit: GitHub - opsee/build-go: Build environment for Go projects. is our build container.