-
Notifications
You must be signed in to change notification settings - Fork 125
/
gosnowflake.mak
41 lines (33 loc) · 1015 Bytes
/
gosnowflake.mak
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
## Setup
SHELL := /bin/bash
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
setup:
@which golint &> /dev/null || go install golang.org/x/lint/golint@latest
@which make2help &> /dev/null || go install github.com/Songmu/make2help/cmd/make2help@latest
@which staticcheck &> /dev/null || go install honnef.co/go/tools/cmd/[email protected]
## Install dependencies
deps: setup
go mod tidy
## Show help
help:
@make2help $(MAKEFILE_LIST)
# Format source codes (internally used)
cfmt: setup
@gofmt -l -w $(SRC)
# Lint (internally used)
clint: deps
@echo "Running staticcheck" && staticcheck
@echo "Running go vet and lint"
@for pkg in $$(go list ./... | grep -v /vendor/); do \
echo "Verifying $$pkg"; \
go vet $$pkg; \
golint -set_exit_status $$pkg || exit $$?; \
done
# Install (internally used)
cinstall:
@export GOBIN=$$GOPATH/bin; \
go install -tags=sfdebug $(CMD_TARGET).go
# Run (internally used)
crun: install
$(CMD_TARGET)
.PHONY: setup help cfmt clint cinstall crun