Files
docker-go-dev/Makefile
sjc 4635517834 Added init and tidy targets to makefile
The docker build fails if the go.sums file needs to be updated.
In the original article, this required a local go install to run
the metadata update commands.

This change updates the Makefile and documentation to add two new
utility targets
2021-06-28 13:29:38 -04:00

34 lines
684 B
Makefile

all: bin/example
test: lint unit-test
PLATFORM=local
UTIL_TAG=1.16.5-alpine
.PHONY: bin/example
bin/example:
@docker build . --target bin \
--output bin/ \
--platform ${PLATFORM}
.PHONY: unit-test
unit-test:
@docker build . --target unit-test
.PHONY: unit-test-coverage
unit-test-coverage:
@docker build . --target unit-test-coverage \
--output coverage/
cat coverage/cover.out
.PHONY: lint
lint:
@docker build . --target lint
.PHONY: tidy
tidy:
@docker run -t -i -v `pwd`:/src --workdir /src --rm golang:${UTIL_TAG} /usr/local/go/bin/go mod tidy
.PHONY: init
init:
@docker run -t -i -v `pwd`:/src --workdir /src --rm golang:${UTIL_TAG} /usr/local/go/bin/go mod init