Skip to content

Commit bc871f5

Browse files
committed
chore(gh): update golangci-lint workflow
- Updates the GitHub Action for `golangci-lint`. - Pin GitHub Actions to release commit SHA. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent 29c3d0a commit bc871f5

File tree

2 files changed

+64
-68
lines changed

2 files changed

+64
-68
lines changed

.github/workflows/golangci-lint.yml

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
name: golangci-lint
22

3-
on: [pull_request, push]
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- 'README.md'
7+
push:
8+
paths-ignore:
9+
- 'README.md'
10+
11+
permissions:
12+
contents: read
413

514
jobs:
6-
golangci:
7-
name: lint
15+
build:
16+
name: Build
817
runs-on: ubuntu-latest
18+
timeout-minutes: 5
919
steps:
10-
- uses: actions/setup-go@v5
20+
- name: Checkout
21+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
22+
- name: Setup Go
23+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
1124
with:
12-
go-version: 1.19
13-
- uses: actions/checkout@v4
14-
- name: golangci-lint
15-
uses: golangci/golangci-lint-action@v6
25+
go-version-file: 'go.mod'
26+
cache: true
27+
- run: go mod download
28+
- run: go build -v .
29+
- name: Run Linters
30+
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
1631
with:
17-
version: v1.48.0
18-
args: --issues-exit-code=1
19-
only-new-issues: true
20-
skip-cache: true
32+
version: latest

.golangci.yml

+40-56
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
1-
# https://github.com/golangci/golangci-lint#config-file
1+
# © Broadcom. All Rights Reserved.
2+
# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
3+
# SPDX-License-Identifier: MPL-2.0
4+
5+
# For more information about the golangci-lint configuration file, refer to:
6+
# https://golangci-lint.run/usage/configuration/
7+
8+
issues:
9+
exclude-rules:
10+
- path: _test\.go
11+
linters:
12+
- dogsled
13+
- funlen
14+
- gocognit
15+
- path: internal/authctx
16+
linters:
17+
- gosec
18+
- nestif
19+
- path: flatten_test.go
20+
linters:
21+
- dupl
222

323
linters:
4-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
5-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
624
disable-all: true
725
enable:
826
- asciicheck
927
- bodyclose
28+
- copyloopvar
1029
- depguard
1130
- dogsled
1231
- dupl
1332
- errcheck
14-
- exportloopref
1533
- funlen
1634
- goconst
1735
- gocognit
@@ -38,81 +56,47 @@ linters:
3856
- whitespace
3957
- wsl
4058

41-
# don't enable:
42-
# - deadcode
43-
# - exhaustive
44-
# - gochecknoglobals
45-
# - godox
46-
# - gomnd
47-
# - goerr113
48-
# - gofumpt
49-
# - interfacer
50-
# - lll
51-
# - maligned
52-
# - nlreturn
53-
# - noctx
54-
# - nolintlint
55-
# - rowserrcheck
56-
# - scopelint
57-
# - structcheck
58-
# - testpackage
59-
# - revive
60-
# - varcheck
61-
6259
run:
63-
# include test files or not, default is true
64-
tests: true
6560
deadline: 5m
6661
build-tags:
6762
- akscluster
6863
- cluster
6964
- clustergroup
65+
- clustersecret
7066
- credential
67+
- custompolicy
7168
- ekscluster
7269
- gitrepository
70+
- helmfeature
71+
- helmrelease
7372
- iampolicy
73+
- imagepolicy
7474
- kustomization
75+
- managementcluster
76+
- mutationpolicy
7577
- namespace
76-
- custompolicy
77-
- imagepolicy
7878
- networkpolicy
79+
- packageinstall
80+
- packagerepository
81+
- provisioner
7982
- quotapolicy
8083
- securitypolicy
8184
- sourcesecret
82-
- workspace
83-
- packageinstall
84-
- packagerepository
85-
- tanzupackages
8685
- tanzupackage
87-
- clustersecret
88-
- mutationpolicy
89-
- helmfeature
90-
- helmrelease
91-
- managementcluster
92-
- provisioner
86+
- tanzupackages
87+
- workspace
88+
89+
output:
90+
formats:
91+
- format: colored-line-number
9392

9493
linters-settings:
9594
funlen:
9695
lines: 150
9796
statements: 100
98-
nestif:
99-
min-complexity: 14
10097
gocognit:
10198
min-complexity: 60
10299
goimports:
103100
local-prefixes: github.com/vmware/terraform-provider-tanzu-mission-control
104-
105-
issues:
106-
exclude-rules:
107-
- path: _test\.go
108-
linters:
109-
- dogsled
110-
- funlen
111-
- gocognit
112-
- path: internal/authctx
113-
linters:
114-
- gosec
115-
- nestif
116-
- path: flatten_test.go
117-
linters:
118-
- dupl
101+
nestif:
102+
min-complexity: 14

0 commit comments

Comments
 (0)