forked from TrueCloudLab/frostfs-sdk-go
3ef4b2c4cf
Create Makefile, go.mod, .golangci.yml. Add coverage and IDE entries to .gitignore Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
40 lines
No EOL
934 B
Makefile
40 lines
No EOL
934 B
Makefile
#!/usr/bin/make -f
|
|
|
|
# Run tests
|
|
test:
|
|
@go test ./... -cover
|
|
|
|
# Pull go dependencies
|
|
dep:
|
|
@printf "⇒ Download requirements: "
|
|
@CGO_ENABLED=0 \
|
|
go mod download && echo OK
|
|
@printf "⇒ Tidy requirements: "
|
|
@CGO_ENABLED=0 \
|
|
go mod tidy -v && echo OK
|
|
|
|
# Run linters
|
|
lint:
|
|
@golangci-lint --timeout=5m run
|
|
|
|
# Run tests with race detection and produce coverage output
|
|
cover:
|
|
@go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic
|
|
@go tool cover -html=coverage.txt -o coverage.html
|
|
|
|
# Reformat code
|
|
format:
|
|
@echo "⇒ Processing gofmt check"
|
|
@gofmt -s -w ./
|
|
@echo "⇒ Processing goimports check"
|
|
@goimports -w ./
|
|
|
|
# Show this help prompt
|
|
help:
|
|
@echo ' Usage:'
|
|
@echo ''
|
|
@echo ' make <target>'
|
|
@echo ''
|
|
@echo ' Targets:'
|
|
@echo ''
|
|
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u
|