Skip to content

Commit 636f4ff

Browse files
Merge branch 'main' into renovate/github.com-getsentry-sentry-go-0.x
2 parents fd22399 + 1931fc0 commit 636f4ff

File tree

17 files changed

+244
-108
lines changed

17 files changed

+244
-108
lines changed

.custom-gcl.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: v2.5.0
2+
name: golangci-lint-nilaway
3+
destination: ./bin
4+
plugins:
5+
- module: "go.uber.org/nilaway"
6+
import: "go.uber.org/nilaway/cmd/gclplugin"
7+
version: "v0.0.0-20250821055425-361559d802f0"

.github/workflows/build-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ jobs:
7373
run: make vet
7474

7575
- name: lint
76-
uses: golangci/golangci-lint-action@v8
76+
run: make lint
77+
78+
- name: nilcheck
79+
run: make nilcheck
7780

7881
- name: Helm Lint
7982
run: make helm-lint

.golangci-nilaway.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "2"
2+
run:
3+
issues-exit-code: 1
4+
output:
5+
formats:
6+
text:
7+
path: stdout
8+
linters:
9+
default: none
10+
enable:
11+
- nilaway
12+
settings:
13+
custom:
14+
nilaway:
15+
type: "module"
16+
description: Static analysis tool to detect potential nil panics in Go code.
17+
settings:
18+
include-pkgs: ""
19+
exclude-file-docstrings: ignore_autogenerated
20+
issues:
21+
max-issues-per-linter: 0
22+
max-same-issues: 0
23+
new: false

Makefile

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ LOCALBIN ?= $(CACHE_BIN)
99
DEVBOX_BIN ?= $(DEVBOX_PACKAGES_DIR)/bin
1010
HELM ?= $(LOCALBIN)/helm
1111
HELM_VERSION ?= v3.16.3
12+
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
13+
GOLANGCI_LINT_VERSION ?= v2.5.0
14+
GOLANGCI_LINT_NILAWAY ?= $(CACHE_BIN)/golangci-lint-nilaway
1215

1316
#####################################################################
1417
# Dev Setup
@@ -31,7 +34,6 @@ LINODE_URL ?= https://api.linode.com
3134
KUBECONFIG_PATH ?= $(CURDIR)/test-cluster-kubeconfig.yaml
3235
SUBNET_KUBECONFIG_PATH ?= $(CURDIR)/subnet-testing-kubeconfig.yaml
3336
MGMT_KUBECONFIG_PATH ?= $(CURDIR)/mgmt-cluster-kubeconfig.yaml
34-
GOLANGCI_LINT_VERSION ?= v2.5.0
3537

3638
# if the $DEVBOX_PACKAGES_DIR env variable exists that means we are within a devbox shell and can safely
3739
# use devbox's bin for our tools
@@ -65,8 +67,12 @@ vet: fmt
6567
go vet ./...
6668

6769
.PHONY: lint
68-
lint:
69-
docker run --rm -w /workdir -v $(PWD):/workdir golangci/golangci-lint:$(GOLANGCI_LINT_VERSION) golangci-lint run -c .golangci.yml --fix
70+
lint: golangci-lint
71+
$(GOLANGCI_LINT) run -c .golangci.yml --fix
72+
73+
.PHONY: lint
74+
nilcheck: golangci-lint-nilaway ## Run nilaway against code.
75+
$(GOLANGCI_LINT_NILAWAY) run -c .golangci-nilaway.yml
7076

7177
.PHONY: gosec
7278
gosec: ## Run gosec against code.
@@ -273,3 +279,25 @@ helm-template: helm
273279
#Verify template works when region and apiToken are passed, and when it is passed as reference.
274280
@$(HELM) template foo deploy/chart --set apiToken="apiToken",region="us-east" > /dev/null
275281
@$(HELM) template foo deploy/chart --set secretRef.apiTokenRef="apiToken",secretRef.name="api",secretRef.regionRef="us-east" > /dev/null
282+
283+
.PHONY: kubectl
284+
kubectl: $(KUBECTL) ## Download kubectl locally if necessary.
285+
$(KUBECTL): $(LOCALBIN)
286+
curl -fsSL https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/$(OS)/$(ARCH_SHORT)/kubectl -o $(KUBECTL)
287+
chmod +x $(KUBECTL)
288+
289+
.PHONY: clusterctl
290+
clusterctl: $(CLUSTERCTL) ## Download clusterctl locally if necessary.
291+
$(CLUSTERCTL): $(LOCALBIN)
292+
curl -fsSL https://github.com/kubernetes-sigs/cluster-api/releases/download/$(CLUSTERCTL_VERSION)/clusterctl-$(OS)-$(ARCH_SHORT) -o $(CLUSTERCTL)
293+
chmod +x $(CLUSTERCTL)
294+
295+
.phony: golangci-lint-nilaway
296+
golangci-lint-nilaway: $(GOLANGCI_LINT_NILAWAY)
297+
$(GOLANGCI_LINT_NILAWAY): $(GOLANGCI_LINT) # Build golangci-lint-nilaway from custom configuration.
298+
$(GOLANGCI_LINT) custom
299+
300+
.phony: golangci-lint
301+
golangci-lint: $(GOLANGCI_LINT)
302+
$(GOLANGCI_LINT): # Build golangci-lint from tools folder.
303+
GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

0 commit comments

Comments
 (0)