Skip to content

Commit

Permalink
chore(deps): downgrade golangci-lint to 1.57.1, update golangci-lint …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
Gearheads committed May 1, 2024
1 parent d8da315 commit d249eaf
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.57
version: v1.57.1

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
13 changes: 7 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
run:
timeout: 10m
tests: false
skip-dirs:
- third_party/*
- pkg/azure/wstrust
skip-files:
- "zz_generated.*\\.go$"
- ".*_mock\\.go"

issues:
max-same-issues: 0
max-issues-per-linter: 0
exclude-rules:
- linters: [golint]
text: "should not use dot imports|don't use an underscore in package name"
exclude-dirs:
- third_party/*
- pkg/azure/wstrust
exclude-files:
- "zz_generated.*\\.go$"
- ".*_mock\\.go"

linters-settings:
gomoddirectives:
Expand Down Expand Up @@ -51,3 +51,4 @@ linters:
- nosnakecase # deprecated by the owner
- interfacebloat
- forcetypeassert # maybe enable in the future
- depguard # maybe enable in the future
2 changes: 1 addition & 1 deletion pkg/flags/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (b *flagBinder) Unmarshal(flagset *pflag.FlagSet, out interface{}) error {

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

fieldV := val.Field(i)
Expand Down
5 changes: 2 additions & 3 deletions pkg/history/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ func FilterHistoryWithFuncs(list *historyv1alpha.HistoryEntryList, filterSpec *F

entries := []historyv1alpha.HistoryEntry{}
for _, entry := range list.Items {
entryToFilter := entry
if FilterEntry(&entryToFilter, filterSpec, filterFucs) {
entries = append(entries, entryToFilter)
if FilterEntry(&entry, filterSpec, filterFucs) {
entries = append(entries, entry)
}
}
list.Items = entries
Expand Down
5 changes: 2 additions & 3 deletions pkg/history/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,8 @@ func (s *storeImpl) filterHistory(filter func(entry *historyv1alpha.HistoryEntry

filteredEntries := []*historyv1alpha.HistoryEntry{}
for _, entry := range historyList.Items {
filterEntry := entry
if filter(&filterEntry) {
filteredEntries = append(filteredEntries, &filterEntry)
if filter(&entry) {
filteredEntries = append(filteredEntries, &entry)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/identity/azure/aad/aad.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type aadConfig struct {

TenantID string `json:"tenant-id" validate:"required"`
ClientID string `json:"client-id" validate:"required"`
AADHost identity.AADHost `json:"aad-host" validate:"required"`
AADHost identity.AADHost `json:"aad-host" validate:"required"`
}

func (p *aadIdentityProvider) Name() string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/identity/saml/sp/aws/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type awsProviderConfig struct {
sp.ProviderConfig

Partition string `json:"partition" validate:"required"`
Region string `json:"region" validate:"required"`
Region string `json:"region" validate:"required"`
}

func NewServiceProvider(itemSelector provider.SelectItemFunc) sp.ServiceProvider {
Expand Down
4 changes: 2 additions & 2 deletions pkg/provider/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ type ClusterProviderConfig struct {
// IdentityProviderConfig represents the base configuration for an
// identity provider.
type IdentityProviderConfig struct {
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
IdpProtocol string `json:"idp-protocol" validate:"required"`
}

Expand Down
6 changes: 2 additions & 4 deletions pkg/provider/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ func ListDiscoveryPluginRegistrations() []*DiscoveryPluginRegistration {

plugins := []*DiscoveryPluginRegistration{}
for _, registration := range discoveryPlugins {
pluginRegistration := registration
plugins = append(plugins, pluginRegistration)
plugins = append(plugins, registration)
}

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

plugins := []*IdentityPluginRegistration{}
for _, registration := range identityPlugins {
pluginRegistration := registration
plugins = append(plugins, pluginRegistration)
plugins = append(plugins, registration)
}

return plugins
Expand Down

0 comments on commit d249eaf

Please sign in to comment.