-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (22 loc) · 746 Bytes
/
Makefile
File metadata and controls
30 lines (22 loc) · 746 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
VERSION ?= $(shell git describe --match 'v[0-9]*' --tags --always)
build:
@go build -ldflags "-X main.version=$(VERSION)"
version:
@echo $(VERSION)
generate-docs:
@go run ./vendor/github.com/swaggo/swag/cmd/swag/main.go init -g pkg/api/api.go
run:
@docker start go-api-database &> /dev/null || docker run -d \
--name go-api-database \
-e POSTGRES_PASSWORD=secret \
-p 5432:5432 postgres &> /dev/null
@DB_CONNECTION='postgresql://postgres:secret@localhost:5432/postgres?sslmode=disable' \
go run -ldflags "-X main.version=$(VERSION)" main.go
docker:
@docker build -t go-api:$(VERSION) .
test:
@go test -v ./...
generate:
@go generate ./...
tools:
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %