Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: set the .PHONY on above the rules #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
APPNAME=ckp

.PHONY: build help check-lint clean build lint test
.DEFAULT_GOAL := help

## test: run tests on cmd and pkg files.
.PHONY: test
test: vet fmt
go test ./...

.PHONY: fmt
fmt:
go fmt ./...

.PHONY: vet
vet:
go vet ./...

## build: build application binary.
.PHONY: build
build:
go build -o $(APPNAME)

.PHONY: check-lint
check-lint:
ifeq (, $(shell which golangci-lint))
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.23.8
Expand All @@ -26,25 +30,32 @@ ifeq (, $(shell which errcheck))
endif

## lint: run linters over the entire code base
.PHONY: lint
lint: check-lint
golangci-lint run ./... --timeout 15m0s
errcheck -exclude ./.golangci-errcheck-exclude.txt ./...

## install-hooks: install hooks
.PHONY: install-hooks
install-hooks:
ln -s $(PWD)/githooks/pre-push .git/hooks/pre-push

## mockgen: generate mocks
.PHONY: mockgen
mockgen:
mockgen -source internal/exec/exec.go -destination mocks/IExec.go -package=mocks
mockgen -source internal/printers/printers.go -destination mocks/IPrinters.go -package=mocks


## clean: remove releases
.PHONY: clean
clean:
rm -rf $(APPNAME)

.PHONY: all
all: help

.PHONY: help
help: Makefile
@echo " Choose a command..."
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'