Skip to content

Commit

Permalink
Cleanup Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
avakarev committed Dec 18, 2021
1 parent e3af55d commit a44ec7c
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
PKGS = $(shell go list ./... 2> /dev/null)
TEST_PKGS = $(shell go list ./internal/... ./pkg/... 2> /dev/null)

GO_MODULE := $(shell awk '/module/{print $$2; exit}' go.mod)
GO_BUILDMETA = github.com/avakarev/dotfiles-cli/internal/buildmeta


print-%: ; @echo $*=$($*)

tidy:
@echo ">> Tidying..."
@go mod tidy

fmt:
@echo ">> Formatting..."
@go fmt $(PKGS)
@go fmt ./...

vet:
@echo ">> Vetting..."
@go vet ${PKGS}
@go vet ./...

lint:
@echo ">> Linting..."
@echo ">> Running revive..."
@revive -config .revive.toml -formatter friendly ./...
@echo ">> Running staticcheck..."
@staticcheck ./...

sec:
@echo ">> Auditing..."
@gosec -conf .gosec.json -quiet ./...
@gosec -conf .gosec.json -quiet -tests ./...

test:
@echo ">> Running tests..."
@go test -v -race ${TEST_PKGS}
@go test -v -race ./...
.PHONY: test

setup-ci:
@GO111MODULE=off go get -u github.com/myitcv/gobin
@gobin github.com/mgechev/revive
@gobin github.com/securego/gosec/v2/cmd/gosec
@go install github.com/mgechev/revive@latest
@go install github.com/securego/gosec/v2/cmd/gosec@latest
@go install honnef.co/go/tools/cmd/staticcheck@latest

ci: lint vet sec test

build:
@echo ">> Building ./bin/dotfiles ..."
@echo ">> Building ./bin/dotfiles..."
@CGO_ENABLED=0 go build -o ./bin/dotfiles ./cmd
@echo " Done!"

Expand Down

0 comments on commit a44ec7c

Please sign in to comment.