diff --git a/Makefile b/Makefile index c4b2ed54d..d2cb9a889 100644 --- a/Makefile +++ b/Makefile @@ -181,6 +181,8 @@ install: external check test: external @$(MAKE) go.test +lint: go.lint + vet: go.vet fmt: go.fmt @@ -226,6 +228,7 @@ help: @echo ' distclean Remove all files that are created ' @echo ' by building or configuring.' @echo ' fmt Check formatting of go sources.' + @echo ' lint Check syntax and styling of go sources.' @echo ' help Show this help info.' @echo ' vendor Installs vendor dependencies.' @echo ' vet Runs lint checks on go sources.' diff --git a/build/makelib/golang.mk b/build/makelib/golang.mk index 7938dfc9b..b8aa7a9f0 100644 --- a/build/makelib/golang.mk +++ b/build/makelib/golang.mk @@ -162,6 +162,10 @@ go.test: go.vet go.fmt # @$(GOHOST) test -v -i $(GO_PKG_FLAGS) $(GO_NONSTATIC_FLAGS) $(GO_ALL_PACKAGES) @$(GOHOST) test -cover $(GO_PKG_FLAGS) $(GO_NONSTATIC_FLAGS) $(GO_ALL_PACKAGES) +.PHONY: go.lint +go.lint: $(GO_TOOLS_DIR)/lint/$(GOHOSTOS)-$(GOHOSTARCH)/golint + @$(GO_TOOLS_DIR)/lint/$(GOHOSTOS)-$(GOHOSTARCH)/golint -set_exit_status=true $(GO_ALL_PACKAGES) + .PHONY: go.vet go.vet: @$(GOHOST) vet $(GO_NONSTATIC_FLAGS) $(GO_ALL_PACKAGES) @@ -183,6 +187,14 @@ $(GO_TOOLS_DIR)/glide: @mv $(GO_TOOLS_DIR)/$(GOHOSTOS)-$(GOHOSTARCH)/glide $(GO_TOOLS_DIR)/glide @rm -r $(GO_TOOLS_DIR)/$(GOHOSTOS)-$(GOHOSTARCH) +$(GO_TOOLS_DIR)/lint/$(GOHOSTOS)-$(GOHOSTARCH)/golint: + @echo "installing golint" + @mkdir -p $(GO_TOOLS_DIR)/tmp/lint/bin + @GOPATH=`pwd`/$(GO_TOOLS_DIR)/tmp/lint GOBIN=`pwd`/$(GO_TOOLS_DIR)/tmp/lint/bin $(GOHOST) get github.com/golang/lint/golint + @mkdir -p $(GO_TOOLS_DIR)/lint/$(GOHOSTOS)-$(GOHOSTARCH) + @mv $(GO_TOOLS_DIR)/tmp/lint/bin/golint $(GO_TOOLS_DIR)/lint/$(GOHOSTOS)-$(GOHOSTARCH)/golint + @rm -rf $(GO_TOOLS_DIR)/tmp + .PHONY: go.clean go.clean: ; @rm -rf $(GO_BIN_DIR)/*