Skip to content

Commit f5e19a0

Browse files
committed
golangci-lint: Update depguard configuration for golangci >= 1.53
Signed-off-by: Mario Trangoni <[email protected]>
1 parent 857da53 commit f5e19a0

File tree

2 files changed

+41
-11
lines changed

2 files changed

+41
-11
lines changed

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
go-version: '1.19'
2424

2525
- name: Checkout code
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2727

2828
- name: Golangci lint
2929
uses: golangci/golangci-lint-action@v3
3030
with:
31-
version: v1.51.0
31+
version: v1.55.1

.golangci.yaml

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,44 @@ linters-settings:
138138
min-len: 3
139139
# minimal occurrences count to trigger, 3 by default
140140
min-occurrences: 8
141-
# depguard:
142-
# list-type: blacklist
143-
# include-go-root: false
144-
# packages:
145-
# - github.com/sirupsen/logrus
146-
# packages-with-error-messages:
147-
# # specify an error message to output when a blacklisted package is used
148-
# github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
141+
depguard:
142+
# Rules to apply.
143+
# Default: Only allow $gostd in all files.
144+
rules:
145+
# Name of a rule.
146+
main:
147+
# List of file globs that will match this list of settings to compare against.
148+
# Default: $all
149+
files:
150+
- "!**/*_a _file.go"
151+
# List of allowed packages.
152+
allow:
153+
- $gostd
154+
- github.com/Masterminds/semver
155+
- github.com/aryann/difflib
156+
- github.com/databus23/helm-diff/v3
157+
- github.com/evanphx/json-patch
158+
- github.com/gonvenience/ytbx
159+
- github.com/google/go-cmp/cmp
160+
- github.com/homeport/dyff/pkg/dyff
161+
- github.com/json-iterator/go
162+
- github.com/mgutz/ansi
163+
- github.com/spf13/cobra
164+
- github.com/spf13/pflag
165+
- github.com/stretchr/testify/require
166+
- helm.sh/helm/v3
167+
- k8s.io/api/core/v1
168+
- k8s.io/apiextensions-apiserver
169+
- k8s.io/apimachinery
170+
- k8s.io/cli-runtime
171+
- k8s.io/client-go
172+
- sigs.k8s.io/yaml
173+
# Packages that are not allowed where the value is a suggestion.
174+
deny:
175+
- pkg: "github.com/sirupsen/logrus"
176+
desc: not allowed
177+
- pkg: "github.com/pkg/errors"
178+
desc: Should be replaced by standard lib errors package
149179
misspell:
150180
# Correct spellings using locale preferences for US or UK.
151181
# Default is to use a neutral variety of English.
@@ -357,4 +387,4 @@ issues:
357387
# new-from-rev: REV
358388

359389
# Show only new issues created in git patch with set file path.
360-
# new-from-patch: path/to/patch/file
390+
# new-from-patch: path/to/patch/file

0 commit comments

Comments
 (0)