Skip to content

Commit 4518a18

Browse files
chore(lint): update golangci-lint (radius-project#11020)
# Description This pull request updates the golangci-lint tool to version 2.8.0 across the development environment and CI workflow, and makes minor improvements to the linter configuration for clarity and compatibility. ## Type of change - This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional). ## Contributor checklist Please verify that the PR meets the following requirements, where applicable: <!-- This checklist uses "TaskRadio" comments to make certain options mutually exclusive. See: https://github.com/mheap/require-checklist-action?tab=readme-ov-file#radio-groups For details on how this works and why it's required. --> - An overview of proposed schema changes is included in a linked GitHub issue. - [ ] Yes <!-- TaskRadio schema --> - [x] Not applicable <!-- TaskRadio schema --> - A design document PR is created in the [design-notes repository](https://github.com/radius-project/design-notes/), if new APIs are being introduced. - [ ] Yes <!-- TaskRadio design-pr --> - [x] Not applicable <!-- TaskRadio design-pr --> - The design document has been reviewed and approved by Radius maintainers/approvers. - [ ] Yes <!-- TaskRadio design-review --> - [x] Not applicable <!-- TaskRadio design-review --> - A PR for the [samples repository](https://github.com/radius-project/samples) is created, if existing samples are affected by the changes in this PR. - [ ] Yes <!-- TaskRadio samples-pr --> - [x] Not applicable <!-- TaskRadio samples-pr --> - A PR for the [documentation repository](https://github.com/radius-project/docs) is created, if the changes in this PR affect the documentation or any user facing updates are made. - [ ] Yes <!-- TaskRadio docs-pr --> - [x] Not applicable <!-- TaskRadio docs-pr --> - A PR for the [recipes repository](https://github.com/radius-project/recipes) is created, if existing recipes are affected by the changes in this PR. - [ ] Yes <!-- TaskRadio recipes-pr --> - [x] Not applicable <!-- TaskRadio recipes-pr --> --------- Signed-off-by: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com>
1 parent 6eb3ff7 commit 4518a18

3 files changed

Lines changed: 35 additions & 16 deletions

File tree

‎.devcontainer/post-create.sh‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ set -e
66
npm install -g @typespec/compiler
77

88
# Adding workspace as safe directory to avoid permission issues
9-
git config --global --add safe.directory /workspaces/radius
9+
git config --global --add safe.directory /workspaces/radius
1010

1111
# Install the binary form of golangci-lint, as recommended
1212
# https://golangci-lint.run/welcome/install/#local-installation
13-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v2.5.0
13+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v2.8.0
1414

1515
# Other go tools
16-
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.17.0
16+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.17.0
1717
go install go.uber.org/mock/mockgen@v0.4.0
1818

1919
# Prerequisites for Code Generation, see https://github.com/radius-project/radius/tree/main/docs/contributing/contributing-code/contributing-code-prerequisites#code-generation
20-
cd typespec || exit
21-
npm ci
20+
cd typespec || exit
21+
npm ci
2222
npm install -g autorest@3.7.2
2323
npm install -g oav@4.0.2

‎.github/workflows/lint.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
- name: Run linter
112112
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
113113
with:
114-
version: v2.5.0
114+
version: v2.8.0
115115
args: --timeout=10m
116116
skip-cache: true
117117
install-mode: binary

‎.golangci.yml‎

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/golangci-lint.json
12
# see https://golangci-lint.run/usage/configuration/ for documentation
3+
---
24
version: "2"
35
linters:
4-
# Only enable forbidigo explicitly. The v2 defaults (errcheck, gosimple, govet,
6+
# Only enable forbidigo explicitly. The v2 defaults (errcheck, gosimple, govet,
57
# ineffassign, staticcheck, unused) are implicitly enabled to match v1 behavior.
68
enable:
7-
- forbidigo
9+
- forbidigo
810
settings:
911
# Configure default linters to match v1 behavior (less strict)
1012
errcheck:
@@ -31,7 +33,7 @@ linters:
3133
- os.RemoveAll
3234
- os.Setenv
3335
- os.Unsetenv
34-
36+
3537
govet:
3638
# Only run a subset of analyzers to match v1 behavior
3739
enable:
@@ -57,15 +59,32 @@ linters:
5759
- unreachable
5860
- unsafeptr
5961
- unusedresult
60-
62+
6163
staticcheck:
6264
# Use the same checks as v1 (disable newer style/quickfix checks)
6365
# QF rules are "quickfix" suggestions that weren't in v1
6466
# ST rules are style checks that are often too pedantic
65-
checks: ["all",
66-
"-ST1000", "-ST1003", "-ST1005", "-ST1016", "-ST1019", "-ST1020", "-ST1021", "-ST1022", "-ST1023",
67-
"-QF1001", "-QF1003", "-QF1004", "-QF1007", "-QF1008", "-QF1011", "-QF1012"]
68-
67+
checks:
68+
[
69+
"all",
70+
"-ST1000",
71+
"-ST1003",
72+
"-ST1005",
73+
"-ST1016",
74+
"-ST1019",
75+
"-ST1020",
76+
"-ST1021",
77+
"-ST1022",
78+
"-ST1023",
79+
"-QF1001",
80+
"-QF1003",
81+
"-QF1004",
82+
"-QF1007",
83+
"-QF1008",
84+
"-QF1011",
85+
"-QF1012",
86+
]
87+
6988
forbidigo:
7089
# Forbid the following identifiers (list of regexp)
7190
#
@@ -75,6 +94,6 @@ linters:
7594
# These APIs exit the process. These are OK to use in the main() function,
7695
# and not ANYWHERE else.
7796
- pattern: 'os\.Exit'
78-
msg: '# Do not use except for inside main(). Suppress this message with //nolint:forbidigo at the end of the line if it is correct.'
97+
msg: "# Do not use except for inside main(). Suppress this message with //nolint:forbidigo at the end of the line if it is correct."
7998
- pattern: 'log\.Fatal(f|ln)?'
80-
msg: '# Do not use except for inside main(). Suppress this message with //nolint:forbidigo at the end of the line if it is correct.'
99+
msg: "# Do not use except for inside main(). Suppress this message with //nolint:forbidigo at the end of the line if it is correct."

0 commit comments

Comments
 (0)