-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (44 loc) · 1.38 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
.SILENT:
build:
go build -o ./bin/app cmd/web/main.go
#run: build
# ./bin/app
run:
docker-compose up --remove-orphans --build app
run-postgres:
docker run --name=todo-db -e POSTGRES_PASSWORD='qwerty' -p 5436:5432 -d postgres
# restart-postgres:
# docker restart todo-db
# stop-postgres:
# docker stop todo-db
# postgres-cli:
# docker exec -it todo-db /bin/bash
create-new-migration:
migrate create -ext sql -dir ./schema -seq init
migrate-up:
migrate -path ./schema -database 'postgres://postgres:qwerty@localhost:5436/postgres?sslmode=disable' up
migrate-down:
migrate -path ./schema -database 'postgres://postgres:qwerty@localhost:5436/postgres?sslmode=disable' down
init-swagger:
swag init -g cmd/web/main.go
test-cover:
go test -coverprofile=coverage.out ./... -v -coverpkg=./...
html-cover: test-cover
go tool cover -html=coverage.out
# build:
# go build -o ./bin/app ./cmd/web/main.go
# run: build
# ./bin/app
# pkgs = $(shell go list ./... | fgrep -v /vendor)
# get-linters: # without golangci-linter
# go get golang.org/x/lint/golint
# go get honnef.co/go/tools/cmd/staticcheck
# go get github.com/kisielk/errcheck
# golint $(pkgs)
# go vet $(pkgs)
# staticcheck $(pkgs)
# errcheck $(pkgs)
lint:
golangci-lint run -c .golangci.yml
gci-lint:
golangci-lint run --fix --disable-all -E govet,gosimple,unused,stylecheck,unparam,staticcheck,errcheck,gofmt,deadcode