Skip to content

Commit

Permalink
Use go run <cmd> in Makefile (#166)
Browse files Browse the repository at this point in the history
Using `go run gotest.tools/gotestsum@latest` syntax allows to download
and install Go commands dynamically in the process of the build, opening
the gates to the new contributors
  • Loading branch information
nfx authored Nov 21, 2022
1 parent b1b3384 commit cf6bddd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ build: vendor

fmt:
@echo "✓ Formatting source code with goimports ..."
@goimports -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
@go run golang.org/x/tools/cmd/goimports@latest -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
@echo "✓ Formatting source code with gofmt ..."
@gofmt -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")

lint: vendor
@echo "✓ Linting source code with https://staticcheck.io/ ..."
@staticcheck ./...
@go run honnef.co/go/tools/cmd/staticcheck@latest ./...

test: lint
@echo "✓ Running tests ..."
@gotestsum --format pkgname-and-test-fails \
@go run gotest.tools/gotestsum@latest --format pkgname-and-test-fails \
--no-summary=skipped --raw-command go test -v \
-json -short -coverprofile=coverage.txt ./...

Expand All @@ -30,6 +30,6 @@ vendor:

doc:
@echo "Open http://localhost:6060"
@godoc -http=localhost:6060
@go run golang.org/x/tools/cmd/godoc@latest -http=localhost:6060

.PHONY: fmt vendor fmt coverage test lint doc

0 comments on commit cf6bddd

Please sign in to comment.