forked from kubernetes/cloud-provider-openstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Replace golint and gofmt by golangci-lint (kubernetes#1860)
Because golint is deprecated we need to replace it by something else. golangci-lint seems like a good fit, because it supports a wide viarity of lintes/checkers. It is also possible to use golangci-lint in IDEs, VS Code for example includes it by default (while it needs to be enabled).
- Loading branch information
Showing
7 changed files
with
35 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
run: | ||
timeout: 10m0s | ||
linters: | ||
disable: | ||
- megacheck | ||
- ineffassign | ||
- structcheck | ||
- errcheck | ||
- deadcode | ||
- varcheck | ||
enable: | ||
- gofmt | ||
output: | ||
format: line-number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
run: | ||
timeout: 10m0s | ||
linters: | ||
enable: | ||
- gofmt | ||
output: | ||
format: line-number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ export TESTARGS ?= $(TESTARGS_DEFAULT) | |
PKG := $(shell awk '/^module/ { print $$2 }' go.mod) | ||
DEST := $(GOPATH)/src/$(GIT_HOST)/$(BASE_DIR) | ||
SOURCES := $(shell find $(DEST) -name '*.go' 2>/dev/null) | ||
HAS_LINT := $(shell command -v golint;) | ||
HAS_GOX := $(shell command -v gox;) | ||
GOX_PARALLEL ?= 3 | ||
|
||
|
@@ -155,7 +154,14 @@ build-cmd-%: work $(SOURCES) | |
|
||
test: unit functional | ||
|
||
check: work fmt vet lint | ||
check: work | ||
go run github.com/golangci/golangci-lint/cmd/[email protected] run ./... --config .golangci-check.yaml | ||
|
||
# NOTE(chrigl): ci actually runs make check. Because golint didn't run on the code for quite some | ||
# time, most linters in make check are disabled. codehygiene serves as a helper to further | ||
# improve the quality of the code base. | ||
codeclimate: work | ||
go run github.com/golangci/golangci-lint/cmd/[email protected] run ./... | ||
|
||
unit: work | ||
go test -tags=unit $(shell go list ./... | sed -e '/sanity/ { N; d; }' | sed -e '/tests/ {N; d;}') $(TESTARGS) | ||
|
@@ -169,18 +175,10 @@ test-cinder-csi-sanity: work | |
test-manila-csi-sanity: work | ||
go test $(GIT_HOST)/$(BASE_DIR)/tests/sanity/manila | ||
|
||
fmt: | ||
hack/verify-gofmt.sh | ||
|
||
lint: | ||
ifndef HAS_LINT | ||
echo "installing lint" | ||
go install golang.org/x/lint/golint@latest | ||
endif | ||
hack/verify-golint.sh | ||
|
||
vet: | ||
go vet ./... | ||
# kept for compatibility reasons. | ||
fmt: check | ||
lint: check | ||
vet: check | ||
|
||
cover: work | ||
go test -tags=unit $(shell go list ./...) -cover | ||
|
@@ -326,4 +324,4 @@ dist: build-cross | |
) | ||
|
||
.PHONY: bindep build clean cover work docs fmt functional lint realclean \ | ||
relnotes test translation version build-cross dist | ||
relnotes test translation version build-cross dist codeclimate |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.