-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
45 lines (34 loc) · 1.01 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
PKGS := $(shell go list ./...)
PKGS_WITHOUT_TEST := $(shell go list ./... | grep -v "gonstructor/internal/test")
RELEASE_DIR=dist
REVISION=$(shell git rev-parse --verify HEAD)
INTERNAL_PACKAGE=github.com/moznion/gonstructor/internal
check: test lint vet fmt-check
check-ci: test vet fmt-check
build4test: clean
mkdir -p $(RELEASE_DIR)
go build -ldflags "-X $(INTERNAL_PACKAGE).rev=$(REVISION) -X $(INTERNAL_PACKAGE).ver=TESTING" \
-o $(RELEASE_DIR)/gonstructor_test cmd/gonstructor/gonstructor.go
gen4test: build4test
go generate $(PKGS)
test: clean-test-gen gen4test
go test -v $(PKGS)
clean-test-gen:
rm -f internal/test/*_gen.go internal/test/**/*_gen.go
lint:
lint:
golangci-lint run ./...
vet:
go vet $(PKGS)
fmt-check:
gofmt -l -s **/*.go | grep [^*][.]go$$; \
EXIT_CODE=$$?; \
if [ $$EXIT_CODE -eq 0 ]; then exit 1; fi; \
goimports -l **/*.go | grep [^*][.]go$$; \
EXIT_CODE=$$?; \
if [ $$EXIT_CODE -eq 0 ]; then exit 1; fi \
fmt:
gofmt -w -s **/*.go
goimports -w **/*.go
clean:
rm -rf bin/gonstructor*