mirror of https://github.com/dtm-labs/dtm.git
committed by
GitHub
3 changed files with 105 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||||
|
run: |
||||
|
deadline: 5m |
||||
|
skip-dirs: |
||||
|
- test |
||||
|
- examples |
||||
|
|
||||
|
linter-settings: |
||||
|
goconst: |
||||
|
min-len: 2 |
||||
|
min-occurrences: 2 |
||||
|
|
||||
|
linters: |
||||
|
enable: |
||||
|
- revive |
||||
|
- goconst |
||||
|
- gofmt |
||||
|
- goimports |
||||
|
- misspell |
||||
|
- unparam |
||||
|
|
||||
|
issues: |
||||
|
exclude-use-default: false |
||||
|
exclude-rules: |
||||
|
- path: _test.go |
||||
|
linters: |
||||
|
- errcheck |
||||
|
- revive |
||||
@ -0,0 +1,74 @@ |
|||||
|
# The old school Makefile, following are required targets. The Makefile is written
|
||||
|
# to allow building multiple binaries. You are free to add more targets or change
|
||||
|
# existing implementations, as long as the semantics are preserved.
|
||||
|
#
|
||||
|
# make - default to 'build' target
|
||||
|
# make lint - code analysis
|
||||
|
# make test - run unit test (or plus integration test)
|
||||
|
# make clean - clean up targets
|
||||
|
#
|
||||
|
#
|
||||
|
# The makefile is also responsible to populate project version information.
|
||||
|
#
|
||||
|
|
||||
|
#
|
||||
|
# Tweak the variables based on your project.
|
||||
|
#
|
||||
|
|
||||
|
|
||||
|
#
|
||||
|
# These variables should not need tweaking.
|
||||
|
#
|
||||
|
|
||||
|
# It's necessary to set this because some environments don't link sh -> bash.
|
||||
|
export SHELL := /bin/bash |
||||
|
|
||||
|
# It's necessary to set the errexit flags for the bash shell.
|
||||
|
export SHELLOPTS := errexit |
||||
|
|
||||
|
# Project output directory.
|
||||
|
OUTPUT_DIR := ./bin |
||||
|
|
||||
|
# Current version of the project.
|
||||
|
VERSION ?= $(shell git describe --tags --always --dirty) |
||||
|
BRANCH ?= $(shell git branch | grep \* | cut -d ' ' -f2) |
||||
|
GITCOMMIT ?= $(shell git rev-parse HEAD) |
||||
|
GITTREESTATE ?= $(if $(shell git status --porcelain),dirty,clean) |
||||
|
BUILDDATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") |
||||
|
appVersion ?= $(VERSION) |
||||
|
|
||||
|
|
||||
|
# Track code version with Docker Label.
|
||||
|
DOCKER_LABELS ?= git-describe="$(shell date -u +v%Y%m%d)-$(shell git describe --tags --always --dirty)" |
||||
|
|
||||
|
# Golang standard bin directory.
|
||||
|
GOPATH ?= $(shell go env GOPATH) |
||||
|
BIN_DIR := $(GOPATH)/bin |
||||
|
GOLANGCI_LINT := $(BIN_DIR)/golangci-lint |
||||
|
|
||||
|
# Default golang flags used in build and test
|
||||
|
# -count: run each test and benchmark 1 times. Set this flag to disable test cache
|
||||
|
export GOFLAGS ?= -count=1 |
||||
|
|
||||
|
#
|
||||
|
# Define all targets. At least the following commands are required:
|
||||
|
#
|
||||
|
|
||||
|
# All targets.
|
||||
|
.PHONY: lint test |
||||
|
|
||||
|
# more info about `GOGC` env: https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
|
||||
|
lint: $(GOLANGCI_LINT) $(HELM_LINT) |
||||
|
@$(GOLANGCI_LINT) run |
||||
|
|
||||
|
$(GOLANGCI_LINT): |
||||
|
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(BIN_DIR) v1.41.0 |
||||
|
|
||||
|
test: |
||||
|
@go test -v -race -gcflags=-l -coverpkg=./... -coverprofile=coverage.out.tmp ./... |
||||
|
@go tool cover -func coverage.out | tail -n 1 | awk '{ print "Total coverage: " $$3 }' |
||||
|
|
||||
|
.PHONY: clean |
||||
|
clean: |
||||
|
@-rm -vrf ${OUTPUT_DIR} output coverage.out coverage.out.tmp |
||||
|
|
||||
Loading…
Reference in new issue