Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Use GOCACHE. It was always being recreated (#64)
Browse files Browse the repository at this point in the history
* Use GOCACHE. It was always being recreated

* Silent build again like it should be

* test fixups
  • Loading branch information
rfay authored Mar 26, 2019
1 parent e90a666 commit 41e767c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion makefile_components/base_build_go.mak
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ DOCKERBUILDCMD=docker run -t --rm -u $(shell id -u):$(shell id -g)
-e CGO_ENABLED=0 \
-e GOOS=$@ \
-e GOPATH="//workdir/$(GOTMP)" \
-e GOCACHE="//workdir/$(GOTMP)/.cache" \
-e GOFLAGS="$(USEMODVENDOR)" \
-w //workdir \
$(BUILD_IMAGE)

DOCKERTESTCMD=docker run -t --rm -u $(shell id -u):$(shell id -g) \
-v "$(S)$(PWD):/workdir$(DOCKERMOUNTFLAG)" \
-e GOPATH="//workdir/$(GOTMP)" \
-e GOCACHE="//workdir/$(GOTMP)/.cache" \
-e GOFLAGS="$(USEMODVENDOR)" \
-w //workdir \
$(BUILD_IMAGE)
Expand Down Expand Up @@ -84,7 +86,7 @@ linux darwin windows: pull $(GOFILES)
@echo "building $@ from $(SRC_AND_UNDER)"
@echo $(shell if [ "$(BUILD_OS)" = "windows" ]; then echo "windows build: BUILD_OS=$(BUILD_OS) DOCKER_TOOLBOX_INSTALL_PATH=$(DOCKER_TOOLBOX_INSTALL_PATH) PWD=$(PWD) S=$(S)"; fi )
@mkdir -p $(GOTMP)/{.cache,pkg,src,bin}
$(DOCKERBUILDCMD) \
@$(DOCKERBUILDCMD) \
go install -installsuffix static -ldflags ' $(LDFLAGS) ' $(SRC_AND_UNDER) && touch $@
$( shell if [ -d $(GOTMP) ]; then chmod -R u+w $(GOTMP); fi )
@echo $(VERSION) >VERSION.txt
Expand Down
6 changes: 3 additions & 3 deletions tests/pkg/clean/build_tools_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ func TestBuild(t *testing.T) {
a.NoError(err, "Failed to 'make darwin'")
a.Contains(string(v), "building darwin")

v, err = exec.Command("make", "linux").Output()
a.NoError(err)
v, err = exec.Command("bash", "-c", "pwd && make linux").Output()
a.NoError(err, "failed 'make linux', err=%v, output='%v'", err, string(v))
a.Contains(string(v), "building linux")

v, err = exec.Command("make", "windows").Output()
v, err = exec.Command("bash", "-c", "pwd && make windows").Output()
a.NoError(err)
a.Contains(string(v), "building windows")

Expand Down

0 comments on commit 41e767c

Please sign in to comment.