diff --git a/Dockerfile b/Dockerfile index 541ee4fd..994df3f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -130,7 +130,6 @@ USER ${build_user} # Install golang module dependencies before copying source to cache them in their own layer WORKDIR /go/src/github.com/controlplaneio/simulator-standalone -RUN go mod download # Add the full source tree COPY --chown=1000 . /go/src/github.com/controlplaneio/simulator-standalone/ @@ -140,11 +139,14 @@ WORKDIR /go/src/github.com/controlplaneio/simulator-standalone/ USER root RUN chown -R ${build_user}:${build_user} /go/src/github.com/controlplaneio/simulator-standalone/ +RUN go get honnef.co/go/tools/cmd/staticcheck USER ${build_user} +RUN mkdir /home/${build_user}/go/bin +ENV PATH=${PATH}:/home/${build_user}/go/bin + # Golang build and test WORKDIR /go/src/github.com/controlplaneio/simulator-standalone -ENV GO111MODULE=on RUN make test-unit #------------------# diff --git a/Makefile b/Makefile index 3d0ea519..76f32c57 100644 --- a/Makefile +++ b/Makefile @@ -111,16 +111,16 @@ docker-test: validate-reqs docker-build ## Run the tests # -- SIMULATOR CLI .PHONY: dep dep: ## Install dependencies for other targets - $(GO) mod download 2>&1 + $(GO) mod download $(GO) get honnef.co/go/tools/cmd/staticcheck .PHONY: static-analysis -static-analysis: - #$(GO) vet +static-analysis: dep + $(GO) vet staticcheck $(PKG) .PHONY: build -build: dep ## Run golang build for the CLI program +build: static-analysis ## Run golang build for the CLI program @echo "+ $@" $(GO) build ${GO_LDFLAGS} -a -o ./dist/simulator