Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci-lint: add gofmt #5738

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ linters:
- bodyclose
- durationcheck
- errorlint
- gofmt
- goimports
- revive
- gosec
Expand Down
16 changes: 8 additions & 8 deletions pkg/server/authorizedentries/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func TestAgentRecordByID(t *testing.T) {

// ExpiresAt is irrelevant.
records := []agentRecord{
agentRecord{ID: "1", ExpiresAt: 9999},
agentRecord{ID: "2", ExpiresAt: 8888},
{ID: "1", ExpiresAt: 9999},
{ID: "2", ExpiresAt: 8888},
}

lesser := agentRecord{}
Expand All @@ -48,12 +48,12 @@ func TestAgentRecordByExpiresAt(t *testing.T) {
}

records := []agentRecord{
agentRecord{ID: "1"},
agentRecord{ID: "2"},
agentRecord{ID: "1", ExpiresAt: 1},
agentRecord{ID: "2", ExpiresAt: 1},
agentRecord{ID: "1", ExpiresAt: 2},
agentRecord{ID: "2", ExpiresAt: 2},
{ID: "1"},
{ID: "2"},
{ID: "1", ExpiresAt: 1},
{ID: "2", ExpiresAt: 1},
{ID: "1", ExpiresAt: 2},
{ID: "2", ExpiresAt: 2},
}

lesser := agentRecord{}
Expand Down
42 changes: 21 additions & 21 deletions pkg/server/authorizedentries/aliases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ func TestAliasRecordByEntryID(t *testing.T) {
}

records := []aliasRecord{
aliasRecord{EntryID: "1"},
aliasRecord{EntryID: "1", Selector: Selector{Type: "1", Value: "1"}},
aliasRecord{EntryID: "1", Selector: Selector{Type: "1", Value: "2"}},
aliasRecord{EntryID: "1", Selector: Selector{Type: "2", Value: "1"}},
aliasRecord{EntryID: "1", Selector: Selector{Type: "2", Value: "2"}},
aliasRecord{EntryID: "2"},
aliasRecord{EntryID: "2", Selector: Selector{Type: "1", Value: "1"}},
aliasRecord{EntryID: "2", Selector: Selector{Type: "1", Value: "2"}},
aliasRecord{EntryID: "2", Selector: Selector{Type: "2", Value: "1"}},
aliasRecord{EntryID: "2", Selector: Selector{Type: "2", Value: "2"}},
{EntryID: "1"},
{EntryID: "1", Selector: Selector{Type: "1", Value: "1"}},
{EntryID: "1", Selector: Selector{Type: "1", Value: "2"}},
{EntryID: "1", Selector: Selector{Type: "2", Value: "1"}},
{EntryID: "1", Selector: Selector{Type: "2", Value: "2"}},
{EntryID: "2"},
{EntryID: "2", Selector: Selector{Type: "1", Value: "1"}},
{EntryID: "2", Selector: Selector{Type: "1", Value: "2"}},
{EntryID: "2", Selector: Selector{Type: "2", Value: "1"}},
{EntryID: "2", Selector: Selector{Type: "2", Value: "2"}},
}

lesser := aliasRecord{}
Expand All @@ -50,17 +50,17 @@ func TestAliasRecordBySelector(t *testing.T) {
}

records := []aliasRecord{
aliasRecord{Selector: Selector{Type: "1", Value: "1"}},
aliasRecord{Selector: Selector{Type: "1", Value: "1"}, EntryID: "1"},
aliasRecord{Selector: Selector{Type: "1", Value: "1"}, EntryID: "2"},
aliasRecord{Selector: Selector{Type: "1", Value: "2"}, EntryID: "1"},
aliasRecord{Selector: Selector{Type: "1", Value: "2"}, EntryID: "2"},
aliasRecord{Selector: Selector{Type: "2", Value: "1"}},
aliasRecord{Selector: Selector{Type: "2", Value: "1"}, EntryID: "1"},
aliasRecord{Selector: Selector{Type: "2", Value: "1"}, EntryID: "2"},
aliasRecord{Selector: Selector{Type: "2", Value: "2"}},
aliasRecord{Selector: Selector{Type: "2", Value: "2"}, EntryID: "1"},
aliasRecord{Selector: Selector{Type: "2", Value: "2"}, EntryID: "2"},
{Selector: Selector{Type: "1", Value: "1"}},
{Selector: Selector{Type: "1", Value: "1"}, EntryID: "1"},
{Selector: Selector{Type: "1", Value: "1"}, EntryID: "2"},
{Selector: Selector{Type: "1", Value: "2"}, EntryID: "1"},
{Selector: Selector{Type: "1", Value: "2"}, EntryID: "2"},
{Selector: Selector{Type: "2", Value: "1"}},
{Selector: Selector{Type: "2", Value: "1"}, EntryID: "1"},
{Selector: Selector{Type: "2", Value: "1"}, EntryID: "2"},
{Selector: Selector{Type: "2", Value: "2"}},
{Selector: Selector{Type: "2", Value: "2"}, EntryID: "1"},
{Selector: Selector{Type: "2", Value: "2"}, EntryID: "2"},
}
lesser := aliasRecord{}
for _, greater := range records {
Expand Down
16 changes: 8 additions & 8 deletions pkg/server/authorizedentries/entries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ func TestEntryRecordByEntryID(t *testing.T) {

// ParentID is irrelevant.
records := []entryRecord{
entryRecord{EntryID: "1", ParentID: "2"},
entryRecord{EntryID: "2", ParentID: "1"},
{EntryID: "1", ParentID: "2"},
{EntryID: "2", ParentID: "1"},
}

lesser := entryRecord{}
Expand All @@ -43,12 +43,12 @@ func TestEntryRecordByParentID(t *testing.T) {
}

records := []entryRecord{
entryRecord{ParentID: "1"},
entryRecord{ParentID: "1", EntryID: "1"},
entryRecord{ParentID: "1", EntryID: "2"},
entryRecord{ParentID: "2"},
entryRecord{ParentID: "2", EntryID: "1"},
entryRecord{ParentID: "2", EntryID: "2"},
{ParentID: "1"},
{ParentID: "1", EntryID: "1"},
{ParentID: "1", EntryID: "2"},
{ParentID: "2"},
{ParentID: "2", EntryID: "1"},
{ParentID: "2", EntryID: "2"},
}

lesser := entryRecord{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/bundle/client/sources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func TestMergedTrustDomainConfigSource(t *testing.T) {
require.NoError(t, err)

require.Equal(t, map[spiffeid.TrustDomain]client.TrustDomainConfig{
domain1: client.TrustDomainConfig{EndpointURL: "A"},
domain2: client.TrustDomainConfig{EndpointURL: "A"},
domain1: {EndpointURL: "A"},
domain2: {EndpointURL: "A"},
}, configs)
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/endpoints/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func TestBundleSource(t *testing.T) {
{
name: "success, with authorities",
getter: func(domain spiffeid.TrustDomain) ([]*x509.Certificate, error) {
return []*x509.Certificate{&x509.Certificate{}}, nil
return []*x509.Certificate{{}}, nil
},
trustDomain: spiffeid.RequireTrustDomainFromString("example.org"),
want: x509bundle.FromX509Authorities(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (a *attestedNodes) updateCache(ctx context.Context) error {
}

func (a *attestedNodes) updateCachedNodes(ctx context.Context) error {
for spiffeId, _ := range a.fetchNodes {
for spiffeId := range a.fetchNodes {
node, err := a.ds.FetchAttestedNode(ctx, spiffeId)
if err != nil {
return err
Expand Down
Loading
Loading