forked from snowflakedb/gosnowflake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gosnowflake.mak
42 lines (34 loc) · 1.11 KB
/
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 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
## TODO(SIG-12286): figure out why staticcheck succeeds for Snowflake's PRs and fails for ours on identical code files
## @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