1515# The binary to build (just the basename).
1616BIN := git-sync
1717
18- # This repo's root import path (under GOPATH).
19- PKG := k8s.io/git-sync
20-
2118# Where to push the docker image.
2219REGISTRY ?= staging-k8s.gcr.io
2320
@@ -82,10 +79,7 @@ build: bin/$(OS)_$(ARCH)/$(BIN)
8279
8380BUILD_DIRS := \
8481 bin/$(OS ) _$(ARCH ) \
85- .go/src/$(PKG ) \
86- .go/pkg \
8782 .go/bin/$(OS ) _$(ARCH ) \
88- .go/std/$(OS ) _$(ARCH ) \
8983 .go/cache
9084
9185# The following structure defeats Go's (intentional) behavior to always touch
@@ -103,21 +97,18 @@ $(OUTBIN): .go/$(OUTBIN).stamp
10397 -ti \
10498 --rm \
10599 -u $$(id -u ) :$$(id -g ) \
106- -v $$(pwd ) :/go/ src/ $( PKG ) \
107- -v $$( pwd ) /.go:/go \
100+ -v $$(pwd ) :/src \
101+ -w /src \
108102 -v $$(pwd ) /.go/bin/$(OS ) _$(ARCH ) :/go/bin \
109103 -v $$(pwd ) /.go/bin/$(OS ) _$(ARCH ) :/go/bin/$(OS ) _$(ARCH ) \
110- -v $$(pwd ) /.go/std/$(OS ) _$(ARCH ) :/usr/local/go/pkg/$(OS ) _$(ARCH ) _static \
111104 -v $$(pwd ) /.go/cache:/.cache \
112- -w /go/src/$(PKG ) \
113105 --env HTTP_PROXY=$(HTTP_PROXY ) \
114106 --env HTTPS_PROXY=$(HTTPS_PROXY ) \
115107 $(BUILD_IMAGE ) \
116108 /bin/sh -c " \
117109 ARCH=$(ARCH ) \
118110 OS=$(OS ) \
119111 VERSION=$(VERSION ) \
120- PKG=$(PKG ) \
121112 ./build/build.sh \
122113 "
123114 @if ! cmp -s .go/$(OUTBIN ) $(OUTBIN ) ; then \
@@ -172,15 +163,13 @@ test: $(BUILD_DIRS)
172163 @docker run \
173164 -ti \
174165 -u $$(id -u ) :$$(id -g ) \
175- -v $$(pwd ) :/go/ src/ $( PKG ) \
176- -v $$( pwd ) /.go:/go \
166+ -v $$(pwd ) :/src \
167+ -w /src \
177168 -v $$(pwd ) /.go/bin/$(OS ) _$(ARCH ) :/go/bin \
178169 -v $$(pwd ) /.go/bin/$(OS ) _$(ARCH ) :/go/bin/$(OS ) _$(ARCH ) \
179- -v $$(pwd ) /.go/std/$(OS ) _$(ARCH ) :/usr/local/go/pkg/$(OS ) _$(ARCH ) _static \
180170 -v $$(pwd ) /.go/cache:/.cache \
181171 --env HTTP_PROXY=$(HTTP_PROXY ) \
182172 --env HTTPS_PROXY=$(HTTPS_PROXY ) \
183- -w /go/src/$(PKG ) \
184173 $(BUILD_IMAGE ) \
185174 /bin/sh -c " \
186175 ./build/test.sh $(SRC_DIRS ) \
0 commit comments