diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index 40676442..00000000 --- a/.golangci.yml +++ /dev/null @@ -1,32 +0,0 @@ -run: - timeout: 10m - -linters: - disable-all: true - enable: - - dupl - - errorlint - - gofmt - - goimports - - gomodguard - - gosimple - - govet - - ineffassign - - misspell - - nakedret - - revive - - unused - - staticcheck - -linters-settings: - gofmt: - simplify: true - gomodguard: - blocked: - modules: - - github.com/pkg/errors: - recommendations: - - errors - - fmt - dupl: - threshold: 400 diff --git a/HACKING.md b/HACKING.md index 785c5d11..63efe0b3 100644 --- a/HACKING.md +++ b/HACKING.md @@ -23,8 +23,7 @@ The following make targets are relevant for any work involving the Go packages. ### Linting -The included Go source code is being examined for any linting violations not included in the standard Go compiler. -Linting is done using [golangci-lint][golangci-lint]. +The included Go source code is being examined for any linting violations by the standard Go compiler. Invocation: @@ -106,6 +105,5 @@ make img/media-types.png ``` [docker]: https://www.docker.com/ -[golangci-lint]: https://github.com/golangci/golangci-lint [graphviz]: https://www.graphviz.org/ [jq]: https://stedolan.github.io/jq/ diff --git a/Makefile b/Makefile index 72cce275..2caf206f 100644 --- a/Makefile +++ b/Makefile @@ -85,10 +85,10 @@ check-license: ## check license headers in source files lint: lint-go lint-md ## Run all linters .PHONY: lint-go -lint-go: .install.lint ## lint check of Go files using golangci-lint - @echo "checking Go lint" - @GO111MODULE=on $(GOPATH)/bin/golangci-lint run - @[ "$$BUILD_SPEC_MODULE_ONLY" = true ] || { cd schema && GO111MODULE=on $(GOPATH)/bin/golangci-lint run; } +lint-go: ## run various checks on the Go files + test -z "$$(go fmt ./...)" + go vet ./... + [ "$$BUILD_SPEC_MODULE_ONLY" = true ] || ( cd schema && test -z "$$(go fmt ./...)" && go vet ./... ) .PHONY: lint-md lint-md: ## Run linting for markdown @@ -98,7 +98,7 @@ lint-md: ## Run linting for markdown .PHONY: test test: ## run the unit tests go test -race -cover ./... - [ "$$BUILD_SPEC_MODULE_ONLY" = true ] || { cd schema && go test -race -cover ./...; } + [ "$$BUILD_SPEC_MODULE_ONLY" = true ] || ( cd schema && go test -race -cover ./... ) img/%.png: img/%.dot ## generate PNG from dot file dot -Tpng $^ > $@ @@ -116,16 +116,6 @@ endif .PHONY: .install.tools install.tools: $(TOOLS:%=.install.%) -.PHONY: .install.lint -.install.lint: - case "$$(go env GOVERSION)" in \ - go1.18.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3;; \ - go1.19.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1;; \ - go1.20.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2;; \ - go1.21.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1;; \ - *) go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest;; \ - esac - .PHONY: .install.gitvalidation .install.gitvalidation: go install github.com/vbatts/git-validation@latest