forked from snowflakedb/gosnowflake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gosnowflake.mak
42 lines (34 loc) · 1001 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
42
## Setup
SHELL := /bin/bash
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
setup:
@which golint &> /dev/null || go get -u golang.org/x/lint/golint
@which make2help &> /dev/null || go get github.com/Songmu/make2help/cmd/make2help
@which staticcheck &> /dev/null || go get honnef.co/go/tools/cmd/staticcheck
## Install dependencies
deps: setup
go mod tidy
go mod vendor
## 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