@@ -8,23 +8,19 @@ ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))
88GOTEST_OPT? =-v -race -timeout 30s
99GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT ) -coverprofile=coverage.txt -covermode=atomic
1010GOTEST =go test
11- GOFMT =gofmt
12- GOLINT =golint
13- GOIMPORTS =goimports
14- GOVET =go vet
1511EMBEDMD =embedmd
1612STATICCHECK =staticcheck
1713# TODO decide if we need to change these names.
1814README_FILES := $(shell find . -name '* README.md' | sort | tr '\n' ' ')
1915
20- .DEFAULT_GOAL := defaul -goal
16+ .DEFAULT_GOAL := default -goal
2117
22- .PHONY : defaul -goal
23- defaul -goal : fmt lint vet embedmd goimports staticcheck test
18+ .PHONY : default -goal
19+ default -goal : lint embedmd staticcheck test
2420
2521# TODO: enable test-with-cover when find out why "scripts/check-test-files.sh: 4: set: Illegal option -o pipefail"
2622.PHONY : ci
27- ci : fmt lint vet embedmd goimports staticcheck test test-386 test-with-coverage
23+ ci : embedmd test test-386 test-with-coverage
2824
2925all-pkgs :
3026 @echo $(ALL_PKGS ) | tr ' ' ' \n' | sort
@@ -56,40 +52,10 @@ test-with-cover:
5652 $(GOTEST ) $(GOTEST_OPT_WITH_COVERAGE ) $(ALL_PKGS )
5753 go tool cover -html=coverage.txt -o coverage.html
5854
59- .PHONY : fmt
60- fmt :
61- @FMTOUT=` $( GOFMT) -s -l $( ALL_SRC) 2>&1 ` ; \
62- if [ " $$ FMTOUT" ]; then \
63- echo " $( GOFMT) FAILED => gofmt the following files:\n" ; \
64- echo " $$ FMTOUT\n" ; \
65- exit 1; \
66- else \
67- echo " Fmt finished successfully" ; \
68- fi
69-
7055.PHONY : lint
7156lint :
72- @LINTOUT=` $( GOLINT) $( ALL_PKGS) 2>&1 ` ; \
73- if [ " $$ LINTOUT" ]; then \
74- echo " $( GOLINT) FAILED => clean the following lint errors:\n" ; \
75- echo " $$ LINTOUT\n" ; \
76- exit 1; \
77- else \
78- echo " Lint finished successfully" ; \
79- fi
57+ golangci-lint run
8058
81- .PHONY : vet
82- vet :
83- # TODO: Understand why go vet downloads "github.com/google/go-cmp v0.2.0"
84- @VETOUT=`$(GOVET) ./... | grep -v "go: downloading" 2>&1`; \
85- if [ "$$VETOUT" ]; then \
86- echo "$(GOVET) FAILED => go vet the following files:\n"; \
87- echo "$$VETOUT\n"; \
88- exit 1; \
89- else \
90- echo "Vet finished successfully"; \
91- fi
92-
9359.PHONY : embedmd
9460embedmd :
9561 @EMBEDMDOUT=` $( EMBEDMD) -d $( README_FILES) 2>&1 ` ; \
@@ -101,25 +67,12 @@ embedmd:
10167 echo " Embedmd finished successfully" ; \
10268 fi
10369
104- .PHONY : goimports
105- goimports :
106- @IMPORTSOUT=` $( GOIMPORTS) -d . 2>&1 ` ; \
107- if [ " $$ IMPORTSOUT" ]; then \
108- echo " $( GOIMPORTS) FAILED => fix the following goimports errors:\n" ; \
109- echo " $$ IMPORTSOUT\n" ; \
110- exit 1; \
111- else \
112- echo " Goimports finished successfully" ; \
113- fi
114-
11570.PHONY : staticcheck
11671staticcheck :
11772 $(STATICCHECK ) ./...
11873
11974.PHONY : install-tools
12075install-tools :
121- GO111MODULE=on go install \
122- golang.org/x/lint/golint \
123- golang.org/x/tools/cmd/goimports \
124- github.com/rakyll/embedmd \
125- honnef.co/go/tools/cmd/staticcheck
76+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
77+ go install github.com/rakyll/embedmd@latest
78+ go install honnef.co/go/tools/cmd/staticcheck@2022.1.3
0 commit comments