Skip to content

Commit c3d677a

Browse files
committed
meta: linter fixup
1 parent d4bd550 commit c3d677a

34 files changed

+77
-81
lines changed

internal/alerting/pagerduty.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (pd *PagerDuty) ping() error {
120120
return fmt.Errorf("pagerduty list abilities: %v", err)
121121
}
122122
if len(resp.Abilities) <= 0 {
123-
return fmt.Errorf("pagerduty: missing abilities")
123+
return errors.New("pagerduty: missing abilities")
124124
}
125125

126126
return nil

internal/alerting/slack.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (s *Slack) AuthTest() error {
5454
return fmt.Errorf("slack auth test: %v", err)
5555
}
5656
if resp.UserID == "" {
57-
return fmt.Errorf("slack: missing user_id")
57+
return errors.New("slack: missing user_id")
5858
}
5959

6060
return nil

internal/dbtest/sql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ func CreateTestDatabase(t *testing.T, config database.DatabaseConfig) database.D
6666
}
6767

6868
dbName := "test" + base.ID()
69-
_, err = rootDb.Exec(fmt.Sprintf("CREATE DATABASE %s", dbName))
69+
_, err = rootDb.Exec("CREATE DATABASE " + dbName)
7070
if err != nil {
7171
t.Fatal(err)
7272
}
7373

7474
t.Cleanup(func() {
75-
rootDb.Exec(fmt.Sprintf("DROP DATABASE %s", dbName))
75+
rootDb.Exec("DROP DATABASE " + dbName)
7676
rootDb.Close()
7777
})
7878

internal/environment_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestEnvironment_Startup(t *testing.T) {
6060
}
6161

6262
env, err := NewEnvironment(env)
63-
a.Nil(err)
63+
a.NoError(err)
6464

6565
t.Cleanup(env.Shutdown)
6666
}

internal/incoming/odfi/prenotes.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"context"
2222
"fmt"
2323
"path/filepath"
24+
"strconv"
2425
"strings"
2526

2627
"github.com/moov-io/ach"
@@ -92,12 +93,12 @@ func (pc *prenoteEmitter) Handle(ctx context.Context, logger log.Logger, file Fi
9293
"origin": log.String(file.ACHFile.Header.ImmediateOrigin),
9394
"destination": log.String(file.ACHFile.Header.ImmediateDestination),
9495
})
95-
logger.Log(fmt.Sprintf("odfi: pre-notification traceNumber=%s", entries[j].TraceNumber))
96+
logger.Log("odfi: pre-notification traceNumber=" + entries[j].TraceNumber)
9697

9798
prenoteEntriesProcessed.With(
9899
"origin", file.ACHFile.Header.ImmediateOrigin,
99100
"destination", file.ACHFile.Header.ImmediateDestination,
100-
"transactionCode", fmt.Sprintf("%d", entries[j].TransactionCode),
101+
"transactionCode", strconv.Itoa(entries[j].TransactionCode),
101102
).Add(1)
102103
}
103104
}

internal/incoming/odfi/reconciliation_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestCreditReconciliation(t *testing.T) {
6565
}
6666
batch.AddEntry(&entry)
6767
}
68-
require.Equal(t, 20, len(file.Batches))
68+
require.Len(t, file.Batches, 20)
6969

7070
// Set ValidateOpts similar to what Processor sets
7171
file.SetValidation(&ach.ValidateOpts{
@@ -122,7 +122,7 @@ func TestCreditReconciliation(t *testing.T) {
122122
return len(sent) > 0
123123
}, 5*time.Second, 100*time.Millisecond)
124124

125-
require.Equal(t, 499, len(sent)) // one from previous subtest
125+
require.Len(t, sent, 499) // one from previous subtest
126126

127127
foundTraces := make(map[string]bool)
128128
for i := range sent {
@@ -132,6 +132,6 @@ func TestCreditReconciliation(t *testing.T) {
132132
require.True(t, ok)
133133
foundTraces[event.Entry.TraceNumber] = true
134134
}
135-
require.Equal(t, 499, len(foundTraces)) // 499 unique trace numbers
135+
require.Len(t, foundTraces, 499) // 499 unique trace numbers
136136
})
137137
}

internal/incoming/stream/streamtest/streamtest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package streamtest
1919

2020
import (
2121
"context"
22-
"fmt"
22+
2323
"testing"
2424

2525
"github.com/moov-io/achgateway/internal/incoming/stream"
@@ -36,7 +36,7 @@ func InmemStream(t *testing.T) (stream.Publisher, stream.Subscription) {
3636
conf := &service.Config{
3737
Inbound: service.Inbound{
3838
InMem: &service.InMemory{
39-
URL: fmt.Sprintf("mem://%s", t.Name()),
39+
URL: "mem://" + t.Name(),
4040
},
4141
},
4242
}

internal/notify/mailslurper_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package notify
66

77
import (
8-
"fmt"
98
"net"
109
"testing"
1110
"time"
@@ -50,7 +49,7 @@ func spawnMailslurp(t *testing.T) *mailslurpDeployment {
5049
err = pool.Retry(func() error {
5150
time.Sleep(1 * time.Second)
5251

53-
conn, err := net.Dial("tcp", fmt.Sprintf("localhost:%s", dep.SMTPPort()))
52+
conn, err := net.Dial("tcp", "localhost:"+dep.SMTPPort())
5453
if err != nil {
5554
return err
5655
}

internal/notify/pagerduty.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (pd *PagerDuty) Ping() error {
4747
return fmt.Errorf("pagerduty list abilities: %v", err)
4848
}
4949
if len(resp.Abilities) <= 0 {
50-
return fmt.Errorf("pagerduty: missing abilities")
50+
return errors.New("pagerduty: missing abilities")
5151
}
5252

5353
return nil

internal/notify/slack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ func marshalSlackMessage(status uploadStatus, msg *Message) string {
6363
slackMsg := fmt.Sprintf("%s %s of %s", status, msg.Direction, msg.Filename)
6464
if msg.Hostname != "" {
6565
if msg.Direction == Upload {
66-
slackMsg += fmt.Sprintf(" to %s", msg.Hostname)
66+
slackMsg += " to " + msg.Hostname
6767
} else {
68-
slackMsg += fmt.Sprintf(" from %s", msg.Hostname)
68+
slackMsg += " from " + msg.Hostname
6969
}
7070
}
7171
slackMsg += " with ODFI server\n"

0 commit comments

Comments
 (0)