Skip to content

Commit 139af12

Browse files
dranicujoekr
authored andcommitted
Upgrade golangci-lint version and configured nilaway (#441)
* updated golangci-lint version and integrated nilaway * added staticcheck linter and increased managed oke version to 1.31.10 for e2e testing
1 parent db549e6 commit 139af12

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

.custom-gcl.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: v2.4.0
2+
plugins:
3+
- module: "go.uber.org/nilaway"
4+
import: "go.uber.org/nilaway/cmd/gclplugin"
5+
version: latest
6+

.golangci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .golangci.yml
2+
version: "2"
3+
linters:
4+
default: none
5+
enable:
6+
- unused
7+
- govet
8+
- nilnil
9+
- staticcheck
10+
- nilnesserr
11+
- nilerr
12+
- nilaway
13+
settings:
14+
custom:
15+
nilaway:
16+
type: module
17+
description: "Static analysis tool to detect potential nil panics in Go code."
18+
settings:
19+
include-pkgs: "github.com/oracle/cluster-api-provider-oci/"
20+
21+
issues:
22+
max-issues-per-linter: 500
23+
max-same-issues: 100

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ KUSTOMIZE := $(BIN_DIR)/$(KUSTOMIZE_BIN)
7272

7373
GOLANGCI_LINT_BIN := golangci-lint
7474
GOLANGCI_LINT := $(BIN_DIR)/$(GOLANGCI_LINT_BIN)
75+
GOLANGCI_LINT_VER := v2.4.0
76+
GOLANGCI_LINT_CONFIG_FILE := ./custom-gcl
77+
LINT_ARGS := run ./...
7578

7679
GINKGO_BIN := ginkgo
7780
GINKGO := $(BIN_DIR)/$(GINKGO_BIN)
@@ -183,8 +186,9 @@ run: manifests generate fmt ## Run a controller from your host.
183186
## Linting
184187
## --------------------------------------
185188

189+
.PHONY: lint
186190
lint: $(GOLANGCI_LINT)
187-
$(GOLANGCI_LINT) run -v --timeout 300s --fast=false
191+
$(GOLANGCI_LINT_CONFIG_FILE) $(LINT_ARGS)
188192

189193
## --------------------------------------
190194
## Docker
@@ -384,7 +388,8 @@ $(GINKGO): ## Build ginkgo.
384388
GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/onsi/ginkgo/v2/ginkgo $(GINKGO_BIN) v2.17.1
385389

386390
$(GOLANGCI_LINT): ## Build golanci-lint.
387-
GOBIN=$(BIN_DIR)/ $(GO_INSTALL) github.com/golangci/golangci-lint/cmd/golangci-lint $(GOLANGCI_LINT_BIN) v1.44.0
391+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BIN_DIR) $(GOLANGCI_LINT_VERSION)
392+
$(GOLANGCI_LINT) custom
388393

389394
$(ENVSUBST): ## Build envsubst from tools folder.
390395
GOBIN=$(TOOLS_BIN_DIR) $(GO_INSTALL) github.com/drone/envsubst/v2/cmd/envsubst $(ENVSUBST_BIN) $(ENVSUBST_VER)

test/e2e/config/e2e_conf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ providers:
8484

8585
variables:
8686
KUBERNETES_VERSION: "v1.29.6"
87-
OCI_MANAGED_KUBERNETES_VERSION: "v1.31.1"
87+
OCI_MANAGED_KUBERNETES_VERSION: "v1.31.10"
8888
OCI_MANAGED_KUBERNETES_VERSION_UPGRADE: "v1.32.1"
8989
EXP_CLUSTER_RESOURCE_SET: "true"
9090
NODE_DRAIN_TIMEOUT: "60s"

0 commit comments

Comments
 (0)