-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
55 lines (41 loc) · 1.4 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
NAME := nomad-driver-singularity
PKG := github.com/sylabs/$(NAME)
CGO_ENABLED := 0
# Set any default go build tags.
BUILDTAGS :=
# Set an output prefix, which is the local directory if not specified
PREFIX?=$(shell pwd)
GOOSARCHES=linux/amd64
GO=$(shell which go)
all: clean build fmt lint test vet
.PHONY: build
build: $(NAME) ## Builds a dynamic executable or package.
$(NAME): $(wildcard *.go) $(wildcard */*.go)
@echo "+ $@"
$(V)GO111MODULE=on GOOS=linux $(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) ./cmd/driver/main.go
.PHONY: fmt
fmt: ## Verifies all files have been `gofmt`ed.
@echo "+ $@"
@gofmt -s -l . | tee /dev/stderr
.PHONY: lint
lint: ## Verifies `golint` passes.
@echo "+ $@"
@golint ./... | tee /dev/stderr
.PHONY: test
test: ## Runs the go tests.
@echo "+ $@"
$(V)GO111MODULE=on $(GO) test -v -tags "$(BUILDTAGS) cgo" ./...
.PHONY: vet
vet: ## Verifies `go vet` passes.
@echo "+ $@"
@$(GO) vet -printfuncs Error,ErrorDepth,Errorf,Errorln,Exit,ExitDepth,Exitf,Exitln,Fatal,FatalDepth,Fatalf,Fatalln,Info,InfoDepth,Infof,Infoln,Warning,WarningDepth,Warningf,Warningln -all ./...
.PHONY: cover
cover: ## Runs go test with coverage.
@echo "" > coverage.txt
$(V)GO111MODULE=on $(GO) test -race -coverprofile=coverage.txt -covermode=atomic ./...; \
.PHONY: clean
clean: ## Cleanup any build binaries or packages.
@echo "+ $@"
$(RM) $(NAME)
dep:
$(V)GO111MODULE=on go mod download