~evanj/cms

ref: wip/cache/listicles cms/makefile -rw-r--r-- 1.0 KiB
2171152dEvan M Jones WIP 4 months ago
                                                                                
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
BIN=cms
ENV=`cat .env`

all: setup vendor gen build

setup:
	@go get git.sr.ht/~evanj/embed/cmd/embed
	@go get github.com/golang/mock/mockgen

vendor: go.mod go.sum
	@go mod tidy
	@go mod vendor

build:
	@go build -ldflags='-s -w' -o $(BIN)

gen: 
	@go generate ./...

test: 
	@env $(ENV) go test ./... -count 1

coverage: 
	@env $(ENV) go test ./... -cover -coverprofile=coverage.out ; go tool cover -html=coverage.out

lint: 
	@env $(ENV) go vet ./...
	# TODO: This encounters a runtime error. Submit issue to golangci-lint?
	# Investigate?
	# @env $(ENV) golangci-lint run --no-config --issues-exit-code=0 \
	# --disable-all --enable=deadcode  --enable=gocyclo --enable=golint --enable=varcheck \
	# --enable=structcheck --enable=maligned --enable=errcheck --enable=dupl --enable=ineffassign \
	# --enable=interfacer --enable=unconvert --enable=goconst --enable=gosec --enable=megacheck

run: gen build
	@clear
	@env $(ENV) ./$(BIN)

dev:
	@find * -not -name '*_embed.go' | grep -E '*.(go|js|css|html)' | entr -r make run