From bc496a0d96a97424c22ea7abe87df4e210b1303b Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Wed, 11 Dec 2019 17:13:43 +0530 Subject: [PATCH] Add the old fmt and vet targets to legacy.mk (#13202) * Add the old fmt and vet targets to legacy.mk This is to ease the transition until a time when everybody has moved to using golangci-lint. * Just run golangci-lint for make vet --- build/legacy.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build/legacy.mk b/build/legacy.mk index d8f914db98..57e2d88387 100644 --- a/build/legacy.mk +++ b/build/legacy.mk @@ -4,6 +4,26 @@ test-te: test-server # test-ee used to just run the enterprise edition tests, but now runs whatever is available test-ee: test-server +## Old target to run go vet. Now it just invokes golangci-lint. +govet: golangci-lint + +gofmt: ## Runs gofmt against all packages. This is now subsumed by make golangci-lint. + @echo Running GOFMT + + @for package in $(TE_PACKAGES) $(EE_PACKAGES); do \ + echo "Checking "$$package; \ + files=$$($(GO) list $(GOFLAGS) -f '{{range .GoFiles}}{{$$.Dir}}/{{.}} {{end}}' $$package); \ + if [ "$$files" ]; then \ + gofmt_output=$$(gofmt -d -s $$files 2>&1); \ + if [ "$$gofmt_output" ]; then \ + echo "$$gofmt_output"; \ + echo "gofmt failure"; \ + exit 1; \ + fi; \ + fi; \ + done + @echo "gofmt success"; \ + # check-licenses was used to check the license of the files, but now is done through mattermost-govet check-licenses: vet