Skip to content

Commit d249eaf

Browse files
committed
chore(deps): downgrade golangci-lint to 1.57.1, update golangci-lint settings, and fix lint errors
This change will downgrade the version of golangci-lint to 1.57.1, because there is currently a bug within 1.57.2 mentioned here golangci/golangci-lint#4606 Signed-off-by: Casale, Robert <[email protected]>
1 parent d8da315 commit d249eaf

File tree

9 files changed

+19
-22
lines changed

9 files changed

+19
-22
lines changed

.github/workflows/golangci-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: golangci/golangci-lint-action@v3
2525
with:
2626
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
27-
version: v1.57
27+
version: v1.57.1
2828

2929
# Optional: working directory, useful for monorepos
3030
# working-directory: somedir

.golangci.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
run:
22
timeout: 10m
33
tests: false
4-
skip-dirs:
5-
- third_party/*
6-
- pkg/azure/wstrust
7-
skip-files:
8-
- "zz_generated.*\\.go$"
9-
- ".*_mock\\.go"
104

115
issues:
126
max-same-issues: 0
137
max-issues-per-linter: 0
148
exclude-rules:
159
- linters: [golint]
1610
text: "should not use dot imports|don't use an underscore in package name"
11+
exclude-dirs:
12+
- third_party/*
13+
- pkg/azure/wstrust
14+
exclude-files:
15+
- "zz_generated.*\\.go$"
16+
- ".*_mock\\.go"
1717

1818
linters-settings:
1919
gomoddirectives:
@@ -51,3 +51,4 @@ linters:
5151
- nosnakecase # deprecated by the owner
5252
- interfacebloat
5353
- forcetypeassert # maybe enable in the future
54+
- depguard # maybe enable in the future

pkg/flags/unmarshal.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (b *flagBinder) Unmarshal(flagset *pflag.FlagSet, out interface{}) error {
9292

9393
// Loop through the struct fields and see if there
9494
// is a matching flag
95-
for i := 0; i < val.NumField(); i++ {
95+
for i := range val.NumField() {
9696
field := t.Field(i)
9797

9898
fieldV := val.Field(i)

pkg/history/filter.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ func FilterHistoryWithFuncs(list *historyv1alpha.HistoryEntryList, filterSpec *F
6666

6767
entries := []historyv1alpha.HistoryEntry{}
6868
for _, entry := range list.Items {
69-
entryToFilter := entry
70-
if FilterEntry(&entryToFilter, filterSpec, filterFucs) {
71-
entries = append(entries, entryToFilter)
69+
if FilterEntry(&entry, filterSpec, filterFucs) {
70+
entries = append(entries, entry)
7271
}
7372
}
7473
list.Items = entries

pkg/history/store.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,8 @@ func (s *storeImpl) filterHistory(filter func(entry *historyv1alpha.HistoryEntry
243243

244244
filteredEntries := []*historyv1alpha.HistoryEntry{}
245245
for _, entry := range historyList.Items {
246-
filterEntry := entry
247-
if filter(&filterEntry) {
248-
filteredEntries = append(filteredEntries, &filterEntry)
246+
if filter(&entry) {
247+
filteredEntries = append(filteredEntries, &entry)
249248
}
250249
}
251250

pkg/plugins/identity/azure/aad/aad.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type aadConfig struct {
8484

8585
TenantID string `json:"tenant-id" validate:"required"`
8686
ClientID string `json:"client-id" validate:"required"`
87-
AADHost identity.AADHost `json:"aad-host" validate:"required"`
87+
AADHost identity.AADHost `json:"aad-host" validate:"required"`
8888
}
8989

9090
func (p *aadIdentityProvider) Name() string {

pkg/plugins/identity/saml/sp/aws/provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type awsProviderConfig struct {
5858
sp.ProviderConfig
5959

6060
Partition string `json:"partition" validate:"required"`
61-
Region string `json:"region" validate:"required"`
61+
Region string `json:"region" validate:"required"`
6262
}
6363

6464
func NewServiceProvider(itemSelector provider.SelectItemFunc) sp.ServiceProvider {

pkg/provider/common/common.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ type ClusterProviderConfig struct {
3636
// IdentityProviderConfig represents the base configuration for an
3737
// identity provider.
3838
type IdentityProviderConfig struct {
39-
Username string `json:"username" validate:"required"`
40-
Password string `json:"password" validate:"required"`
39+
Username string `json:"username" validate:"required"`
40+
Password string `json:"password" validate:"required"`
4141
IdpProtocol string `json:"idp-protocol" validate:"required"`
4242
}
4343

pkg/provider/registry/registry.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ func ListDiscoveryPluginRegistrations() []*DiscoveryPluginRegistration {
129129

130130
plugins := []*DiscoveryPluginRegistration{}
131131
for _, registration := range discoveryPlugins {
132-
pluginRegistration := registration
133-
plugins = append(plugins, pluginRegistration)
132+
plugins = append(plugins, registration)
134133
}
135134

136135
return plugins
@@ -142,8 +141,7 @@ func ListIdentityPluginRegistrations() []*IdentityPluginRegistration {
142141

143142
plugins := []*IdentityPluginRegistration{}
144143
for _, registration := range identityPlugins {
145-
pluginRegistration := registration
146-
plugins = append(plugins, pluginRegistration)
144+
plugins = append(plugins, registration)
147145
}
148146

149147
return plugins

0 commit comments

Comments
 (0)