-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (37 loc) · 1.22 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
GO ?= GOPRIVATE=github.com/Rent-Set go
GOLINT ?= golint
# with caching
#GOLANGCILINT ?= docker run --rm -v $(shell pwd):/app -v ~/.cache/golangci-lint/v1.57.2:/root/.cache -w /app golangci/golangci-lint:v1.57.2 golangci-lint
# no caching
GOLANGCILINT ?= docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.57.2 golangci-lint
GOSEC ?= gosec
GOPATH ?= $(shell go env GOPATH)
VERSION ?=$(shell git describe --tags --always)
PACKAGES = $(shell go list -f {{.Dir}} ./... | grep -v /vendor/ | grep -v /proto )
DATE = $(shell date -R)
FILE_IN?=./examples/2x3_packed.png
FILE_OUT=./out/output.local.png
BIN_NAME=autotiler
.PHONY: build
build:
go build -o ./out/$(BIN_NAME) .
.PHONY: tidy
tidy:
$(GO) mod tidy
.PHONY: mod-download
mod-download:
$(GO) mod download
.PHONY: lint
lint: ## Lint the codebase.
$(GO) vet ${PACKAGES}
$(GOLANGCILINT) run -v
.PHONY: gosec
gosec:
gosec -fmt=json -out=gosec.out.local.json ./...
.PHONY: src-fmt
src-fmt:
gofmt -s -w ${PACKAGES}
gci write --skip-generated --skip-vendor --section Standard --section Default --section "Prefix(github.com/krylphi)" --section "Prefix(github.com/krylphi/$(BIN_NAME))" ${PACKAGES}
.PHONY: unpack
unpack:
go run . -in $(FILE_IN) -o $(FILE_OUT) -e all