-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
44 lines (35 loc) · 1.13 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
#! /usr/bin/make -f
MAKEFLAGS += --silent
# Go related variables.
GOBASE := $(shell pwd)
GOBIN := $(GOBASE)/bin
GOPKG := $(.)
# A valid GOPATH is required to use the `go get` command.
# If $GOPATH is not specified, $HOME/go will be used by default
GOPATH := $(if $(GOPATH),$(GOPATH),~/go)
get:
@echo " > Checking if there are any missing dependencies..."
GOBIN=$(GOBIN) go get ./... $(get)
test:
@echo " > Running unit tests"
GOBIN=$(GOBIN) go test -race ./...
fmt:
@echo " > Running go fmt"
GOBIN=$(GOBIN) go fmt ./...
lint: go-lint
go-lint-install:
@echo " > Installing golint"
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./bin v1.54.1
go-lint:
@echo " > Checking if golint is installed..."
@if [ ! -x "./bin/golangci-lint" ]; then \
echo "golangci-lint not found, installing..."; \
$(MAKE) go-lint-install; \
fi
@echo " > Running golint"
@./bin/golangci-lint version
@./bin/golangci-lint run --timeout=2m
codegen-types:
@echo "Running generate_types.sh from the codegen directory..."
@cd codegen && ./generate_types.sh
@echo "Script execution completed."