Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Disable go modules
Browse files Browse the repository at this point in the history
go 1.13 by default enables go modules feature, where we use 'dep' tool for
module/package dependency. Till we move to go modules disable(GO111MODULE=off) this.
  • Loading branch information
avalluri committed Oct 30, 2019
1 parent b6c2a21 commit 127e7ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

GO=GOOS=linux GO111MODULE=off go
IMPORT_PATH=github.com/intel/pmem-csi
CMDS=pmem-csi-driver pmem-vgm pmem-ns-init
TEST_CMDS=$(addsuffix -test,$(CMDS))
Expand Down Expand Up @@ -58,21 +59,21 @@ all: build
# Build all binaries, including tests.
# Must use the workaround from https://github.com/golang/go/issues/15513
build: $(CMDS) $(TEST_CMDS)
go test -run none ./pkg/... ./test/e2e
$(GO) test -run none ./pkg/... ./test/e2e

# "make test" runs a variety of fast tests, including building all source code.
# More tests are added elsewhere in this Makefile and test/test.make.
test: build

# Build production binaries.
$(CMDS):
GOOS=linux go build -ldflags '-X github.com/intel/pmem-csi/pkg/[email protected]=${VERSION}' -a -o ${OUTPUT_DIR}/$@ ./cmd/$@
$(GO) build -ldflags '-X github.com/intel/pmem-csi/pkg/[email protected]=${VERSION}' -a -o ${OUTPUT_DIR}/$@ ./cmd/$@

# Build a test binary that can be used instead of the normal one with
# additional "-run" parameters. In contrast to the normal it then also
# supports -test.coverprofile.
$(TEST_CMDS): %-test:
GOOS=linux go test --cover -covermode=atomic -c -coverpkg=./pkg/... -ldflags '-X github.com/intel/pmem-csi/pkg/$*.version=${VERSION}' -o ${OUTPUT_DIR}/$@ ./cmd/$*
$(GO) test --cover -covermode=atomic -c -coverpkg=./pkg/... -ldflags '-X github.com/intel/pmem-csi/pkg/$*.version=${VERSION}' -o ${OUTPUT_DIR}/$@ ./cmd/$*

# The default is to refresh the base image once a day when building repeatedly.
# This is achieved by passing a fake variable that changes its value once per day.
Expand Down Expand Up @@ -111,7 +112,7 @@ print-image-version:
@ echo "$(IMAGE_VERSION)"

clean:
go clean -r -x
$(GO) clean -r -x
-rm -rf $(OUTPUT_DIR)

.PHONY: all build test clean $(CMDS) $(TEST_CMDS)
Expand Down
16 changes: 8 additions & 8 deletions test/test.make
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
TEST_CMD=go test
TEST_CMD=$(GO) test
TEST_ARGS=$(IMPORT_PATH)/pkg/...
SUDO=$(shell [ $$(id -u) -eq 0 ] && echo env || echo sudo)

.PHONY: vet
test: vet
go vet $(IMPORT_PATH)/pkg/...
$(GO) vet $(IMPORT_PATH)/pkg/...

# Check resp. fix formatting.
.PHONY: test_fmt fmt
Expand Down Expand Up @@ -60,7 +60,7 @@ RUNTIME_DEPS =
# We use "go list" because it is readily available. A good replacement
# would be godeps. We list dependencies recursively, not just the
# direct dependencies.
RUNTIME_DEPS += go list -f '{{ join .Deps "\n" }}' ./cmd/pmem-csi-driver |
RUNTIME_DEPS += $(GO) list -f '{{ join .Deps "\n" }}' ./cmd/pmem-csi-driver |

# This focuses on packages that are not in Golang core.
RUNTIME_DEPS += grep '^github.com/intel/pmem-csi/vendor/' |
Expand Down Expand Up @@ -120,7 +120,7 @@ RUN_E2E = KUBECONFIG=`pwd`/_work/$(CLUSTER)/kube.config \
CLUSTER=$(CLUSTER) \
TEST_DEPLOYMENTMODE=$(shell source test/test-config.sh; echo $$TEST_DEPLOYMENTMODE) \
TEST_DEVICEMODE=$(shell source test/test-config.sh; echo $$TEST_DEVICEMODE) \
go test -count=1 -timeout 0 -v ./test/e2e \
$(GO) test -count=1 -timeout 0 -v ./test/e2e \
-ginkgo.skip='$(subst $(space),|,$(TEST_E2E_SKIP))' \
-ginkgo.focus='$(subst $(space),|,$(TEST_E2E_FOCUS))' \
-report-dir=$(TEST_E2E_REPORT_DIR)
Expand All @@ -131,7 +131,7 @@ test_e2e: start
.PHONY: run_tests
test: run_tests run_device_manager_tests
RUN_TESTS = TEST_WORK=$(abspath _work) \
$(TEST_CMD) $(shell go list $(TEST_ARGS) | grep -v pmem-device-manager | sed -e 's;$(IMPORT_PATH);.;')
$(TEST_CMD) $(shell $(GO) list $(TEST_ARGS) | grep -v pmem-device-manager | sed -e 's;$(IMPORT_PATH);.;')
RUN_DM_TESTS = \
$(TEST_CMD) ./pkg/pmem-device-manager -exec $(SUDO)
run_tests: _work/pmem-ca/.ca-stamp _work/evil-ca/.ca-stamp
Expand Down Expand Up @@ -161,7 +161,7 @@ _work/gocovmerge-$(GOCOVMERGE_VERSION):
cd $$tmpdir && \
echo "module foo" >go.mod && \
go get github.com/wadey/gocovmerge@$(GOCOVMERGE_VERSION) && \
go build -o $(abspath $@) github.com/wadey/gocovmerge
$(GO) build -o $(abspath $@) github.com/wadey/gocovmerge
ln -sf $(@F) _work/gocovmerge

# This is a special target that runs unit and E2E testing and
Expand Down Expand Up @@ -189,10 +189,10 @@ _work/coverage.out: _work/gocovmerge-$(GOCOVMERGE_VERSION)
$< _work/coverage/* >$@

_work/coverage.html: _work/coverage.out
go tool cover -html $< -o $@
$(G0) tool cover -html $< -o $@

_work/coverage.txt: _work/coverage.out
go tool cover -func $< -o $@
$(GO) tool cover -func $< -o $@

.PHONY: coverage
coverage:
Expand Down

0 comments on commit 127e7ac

Please sign in to comment.