-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
30 lines (22 loc) · 880 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.PHONY: all deps build test check
GO ?= go
# "As of Go 1.13, the go command by default downloads and authenticates modules using the
# Go module mirror and Go checksum database run by Google"
# see go help module-private for detail
GOPRIVATE ?=
GOLINT ?= golint
ENV ?= local
GITURL ?= [email protected]
deps:
GOPRIVATE=${GOPRIVATE} $(GO) mod download
# Use a github token or similar to access private repos
# In this example it's got no efffexct rather than changing from ssh to https
gitconfig:
git config --global url.${GITURL}.insteadOf https://github.com
build: deps
ENV=${ENV} CGO_ENABLED=0 $(GO) build -ldflags="-X 'github.com/AndersonQ/go-skeleton/handlers.version=$$(git rev-parse HEAD)' -X 'github.com/AndersonQ/go-skeleton/handlers.buildTime=$$(date -R)'"
test: deps
$(GO) test -cover ./...
check:
$(GO) vet $$($(GO) list ./...)
$(GOLINT) $$($(GO) list ./...)