-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (39 loc) · 876 Bytes
/
Makefile
File metadata and controls
52 lines (39 loc) · 876 Bytes
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
48
49
50
51
52
APP := codern
VERSION := $(shell git describe --tags --abbrev=0 || echo "0.0.0")
DATE := $(shell date +"%Y-%m-%dT%H:%M:%SZ")
VER_FLAGS = -X 'github.com/codern-org/codern/internal/constant.Version=$(VERSION)'
LD_FLAGS ?= -s -w
.PHONY: build
build:
$(info Build version $(VERSION) ($(DATE)))
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build \
-ldflags="$(LD_FLAGS) $(VER_FLAGS)" \
-o dist/$(APP) main.go
@echo Build sucessfully
.PHONY: clean
clean:
go clean
rm -rf dist/$(APP)
.PHONY: dev
dev:
ENVIRONMENT=development go run .
.PHONY: test
test:
go test -v ./...
.PHONY: lint
lint:
go vet
golangci-lint run
.PHONY: vulncheck
vulncheck:
govulncheck -show verbose ./...
.PHONY: sec
sec:
gosec ./...
.PHONY: migrate-db
migrate-db:
go run ./internal/cmd/mysql_migration.go
.PHONY: swagger
swagger:
swag init --parseDependency -o ./other/swagger