-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (33 loc) · 970 Bytes
/
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
.PHONY: go-imports go-lint
go-imports:
@echo Checking correct formatting of files
@{ \
GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports; \
files=$$( goimports -w -l . ); \
if [ -n "$$files" ]; then \
echo "Files not properly formatted: $$files"; \
exit 1; \
fi; \
if ! go vet ./...; then \
exit 1; \
fi \
}
go-lint:
@echo Checking linting of files
@{ \
GO111MODULE=off go get -u golang.org/x/lint/golint; \
el="_test.go"; \
lintfiles=$$( golint ./... | egrep -v "$$el" ); \
if [ -n "$$lintfiles" ]; then \
echo "Lint errors:"; \
echo "$$lintfiles"; \
exit 1; \
fi \
}
## Use docker mounting the current directory to /
GO_SWAGGER ?= docker run --platform linux/amd64 --rm -u "$(USER_GROUP)" -v "$(CURDIR)":/ -w / quay.io/goswagger/swagger:v0.25.0
go-swagger-gen: ## Generate go model code from swagger spec
$(GO_SWAGGER) -q generate model \
--accept-definitions-only \
--target=./pkg/ \
--spec=./swagger.yml