-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (42 loc) · 1.56 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
56
57
# =================================================================
#
# Copyright (C) 2021 Spatial Current, Inc. - All Rights Reserved
# Released as open source under the MIT License. See LICENSE file.
#
# =================================================================
.PHONY: help
help: ## Print the help documentation
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
#
# Go building, formatting, testing, and installing
#
fmt: ## Format Go source code
go fmt $$(go list ./... )
.PHONY: imports
imports: bin/goimports ## Update imports in Go source code
# If missing, install goimports with: go get golang.org/x/tools/cmd/goimports
bin/goimports -w -local github.com/spatialcurrent/go-flat,github.com/spatialcurrent $$(find . -iname '*.go')
vet: ## Vet Go source code
go vet github.com/spatialcurrent/go-flat/pkg/... # vet packages
tidy: ## Tidy Go source code
go mod tidy
.PHONY: test_go
test_go: bin/errcheck bin/misspell bin/staticcheck bin/shadow ## Run Go tests
bash scripts/test.sh
#
# Command line Programs
#
bin/errcheck:
go build -o bin/errcheck github.com/kisielk/errcheck
bin/goimports:
go build -o bin/goimports golang.org/x/tools/cmd/goimports
bin/misspell:
go build -o bin/misspell github.com/client9/misspell/cmd/misspell
bin/staticcheck:
go build -o bin/staticcheck honnef.co/go/tools/cmd/staticcheck
bin/shadow:
go build -o bin/shadow golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
## Clean
.PHONY: clean
clean: ## Clean artifacts
rm -fr bin