new linter commands (#9020)
This commit is contained in:
parent
7d665904fc
commit
9c54c8e233
|
|
@ -16,7 +16,6 @@ linters:
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- typecheck
|
- typecheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unparam
|
|
||||||
- unused
|
- unused
|
||||||
- varcheck
|
- varcheck
|
||||||
|
|
||||||
|
|
@ -73,7 +72,7 @@ linters-settings:
|
||||||
- name: unhandled-error
|
- name: unhandled-error
|
||||||
- name: unnecessary-stmt
|
- name: unnecessary-stmt
|
||||||
- name: unreachable-code
|
- name: unreachable-code
|
||||||
- name: unused-parameter
|
# - name: unused-parameter
|
||||||
- name: var-declaration
|
- name: var-declaration
|
||||||
- name: var-naming
|
- name: var-naming
|
||||||
- name: waitgroup-by-value
|
- name: waitgroup-by-value
|
||||||
|
|
@ -96,6 +95,7 @@ run:
|
||||||
- docs
|
- docs
|
||||||
- etc
|
- etc
|
||||||
- scripts
|
- scripts
|
||||||
|
# - plugins/parsers/influx/machine.go
|
||||||
|
|
||||||
# which files to skip: they will be analyzed, but issues from them
|
# which files to skip: they will be analyzed, but issues from them
|
||||||
# won't be reported. Default value is empty list, but there is
|
# won't be reported. Default value is empty list, but there is
|
||||||
|
|
|
||||||
38
Makefile
38
Makefile
|
|
@ -69,15 +69,17 @@ all:
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@echo 'Targets:'
|
@echo 'Targets:'
|
||||||
@echo ' all - download dependencies and compile telegraf binary'
|
@echo ' all - download dependencies and compile telegraf binary'
|
||||||
@echo ' deps - download dependencies'
|
@echo ' deps - download dependencies'
|
||||||
@echo ' telegraf - compile telegraf binary'
|
@echo ' telegraf - compile telegraf binary'
|
||||||
@echo ' test - run short unit tests'
|
@echo ' test - run short unit tests'
|
||||||
@echo ' fmt - format source files'
|
@echo ' fmt - format source files'
|
||||||
@echo ' tidy - tidy go modules'
|
@echo ' tidy - tidy go modules'
|
||||||
@echo ' lint - run linter'
|
@echo ' lint - run linter'
|
||||||
@echo ' check-deps - check docs/LICENSE_OF_DEPENDENCIES.md'
|
@echo ' lint-branch - run linter on changes in current branch since master'
|
||||||
@echo ' clean - delete build artifacts'
|
@echo ' lint-install - install linter'
|
||||||
|
@echo ' check-deps - check docs/LICENSE_OF_DEPENDENCIES.md'
|
||||||
|
@echo ' clean - delete build artifacts'
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo 'Package Targets:'
|
@echo 'Package Targets:'
|
||||||
@$(foreach dist,$(dists),echo " $(dist)";)
|
@$(foreach dist,$(dists),echo " $(dist)";)
|
||||||
|
|
@ -131,14 +133,28 @@ vet:
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
.PHONY: lint-install
|
||||||
|
lint-install:
|
||||||
|
|
||||||
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.38.0
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
ifeq (, $(shell which golangci-lint))
|
ifeq (, $(shell which golangci-lint))
|
||||||
$(info golangci-lint can't be found, please install it: https://golangci-lint.run/usage/install/)
|
$(info golangci-lint can't be found, please run: make lint-install)
|
||||||
exit 1
|
exit 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
golangci-lint -v run
|
golangci-lint run
|
||||||
|
|
||||||
|
.PHONY: lint-branch
|
||||||
|
lint-branch:
|
||||||
|
ifeq (, $(shell which golangci-lint))
|
||||||
|
$(info golangci-lint can't be found, please run: make lint-install)
|
||||||
|
exit 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
golangci-lint run --new-from-rev master
|
||||||
|
|
||||||
.PHONY: tidy
|
.PHONY: tidy
|
||||||
tidy:
|
tidy:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue