-
-
Notifications
You must be signed in to change notification settings - Fork 511
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Go install gotestsum and golangci-lint (#2127)
* Update commons-test.mk * Update ci-test-go.yml * Update ci-windows.yml * Update commons-test.mk
- Loading branch information
Showing
3 changed files
with
24 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
GOBIN= $(GOPATH)/bin | ||
|
||
define go_install | ||
go install $(1) | ||
endef | ||
|
||
$(GOBIN)/golangci-lint: | ||
$(call go_install,github.com/golangci/golangci-lint/cmd/[email protected]) | ||
|
||
$(GOBIN)/gotestsum: | ||
$(call go_install,gotest.tools/gotestsum@latest) | ||
|
||
.PHONY: install | ||
install: $(GOBIN)/golangci-lint $(GOBIN)/gotestsum | ||
|
||
.PHONY: clean | ||
clean: | ||
rm $(GOBIN)/golangci-lint | ||
rm $(GOBIN)/gotestsum | ||
|
||
.PHONY: dependencies-scan | ||
dependencies-scan: | ||
@echo ">> Scanning dependencies in $(CURDIR)..." | ||
go list -json -m all | docker run --rm -i sonatypecommunity/nancy:latest sleuth --skip-update-check | ||
|
||
.PHONY: lint | ||
lint: | ||
lint: $(GOBIN)/golangci-lint | ||
golangci-lint run --out-format=github-actions --path-prefix=. --verbose -c $(ROOT_DIR)/.golangci.yml --fix | ||
|
||
.PHONY: test-% | ||
test-%: | ||
test-%: $(GOBIN)/gotestsum | ||
@echo "Running $* tests..." | ||
gotestsum \ | ||
--format short-verbose \ | ||
|
@@ -26,8 +45,7 @@ tools: | |
go mod download | ||
|
||
.PHONY: test-tools | ||
test-tools: | ||
go install gotest.tools/gotestsum@latest | ||
test-tools: $(GOBIN)/gotestsum | ||
|
||
.PHONY: tools-tidy | ||
tools-tidy: | ||
|