-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (24 loc) · 807 Bytes
/
Copy pathMakefile
File metadata and controls
34 lines (24 loc) · 807 Bytes
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
BINARY := swk
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags "-X github.com/agejevasv/swk/cmd.Version=$(VERSION)"
.PHONY: build test lint clean install
build:
go build $(LDFLAGS) -o $(BINARY) .
test:
go test ./...
test-verbose:
go test -v ./...
test-cover:
go test -coverprofile=coverage.out $$(go list ./... | grep -v 'github.com/agejevasv/swk$$' | grep -v 'github.com/agejevasv/swk/cmd$$')
go tool cover -func=coverage.out
STATICCHECK := $(shell go env GOPATH)/bin/staticcheck
lint: $(STATICCHECK)
@test -z "$$(gofmt -s -l .)" || (gofmt -s -l . && exit 1)
go vet ./...
$(STATICCHECK) ./...
$(STATICCHECK):
go install honnef.co/go/tools/cmd/staticcheck@latest
clean:
rm -f $(BINARY) coverage.out
install:
go install $(LDFLAGS) .