chore: fix errors reported by running make lint (#21015)

This commit is contained in:
Halimao 2024-07-23 02:01:07 +08:00 committed by GitHub
parent ba7e6be7e9
commit c2df06c985
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 8 deletions

View File

@ -9,9 +9,7 @@ import (
embeddedpostgres "github.com/fergusstrange/embedded-postgres"
"github.com/hashicorp/consul/sdk/freeport"
// this is where we get our pgx database driver from
_ "github.com/jackc/pgx/v5/stdlib"
_ "github.com/jackc/pgx/v5/stdlib" // this is where we get our pgx database driver from
"github.com/stretchr/testify/require"
"gotest.tools/v3/golden"

View File

@ -68,7 +68,7 @@ func TestMiddleware_filtered(t *testing.T) {
tl := newTestFixture(t)
listener, err := Middleware(tl.Listener, tl.resolver, MiddlewareOptions{
ModuleFilter: func(moduleName string) bool {
return moduleName == "one"
return moduleName == "one" //nolint:goconst // adding constants for this would impede readability
},
})
if err != nil {
@ -176,6 +176,7 @@ type testFixture struct {
}
func newTestFixture(t *testing.T) *testFixture {
t.Helper()
res := &testFixture{}
res.Listener = appdata.Listener{
InitializeModuleData: func(data appdata.ModuleInitializationData) error {
@ -246,7 +247,7 @@ func newTestMultiStore() *testMultiStore {
var _ SyncSource = &testMultiStore{}
func (ms *testMultiStore) IterateAllKVPairs(moduleName string, fn func(key []byte, value []byte) error) error {
func (ms *testMultiStore) IterateAllKVPairs(moduleName string, fn func(key, value []byte) error) error {
s, ok := ms.stores[moduleName]
if !ok {
return fmt.Errorf("don't have state for module %s", moduleName)
@ -267,6 +268,7 @@ func (ms *testMultiStore) IterateAllKVPairs(moduleName string, fn func(key []byt
}
func (ms *testMultiStore) newTestStore(t *testing.T, modName string) *testStore {
t.Helper()
s := &testStore{
t: t,
modName: modName,

View File

@ -39,7 +39,6 @@ func TestModuleSetDecoderResolver_IterateAll(t *testing.T) {
objectTypes[cdc.Schema.ObjectTypes[0].Name] = true
return nil
})
if err != nil {
t.Fatalf("unexpected error: %v", err)
}

View File

@ -8,7 +8,6 @@ import (
// SyncSource is an interface that allows indexers to start indexing modules with pre-existing state.
// It should generally be a wrapper around the key-value store.
type SyncSource interface {
// IterateAllKVPairs iterates over all key-value pairs for a given module.
IterateAllKVPairs(moduleName string, fn func(key, value []byte) error) error
}

View File

@ -19,7 +19,7 @@ import (
func setupContinousAccount(t *testing.T, ctx context.Context, ss store.KVStoreService) *ContinuousLockingAccount {
t.Helper()
deps := makeMockDependencies(ss)
owner := "owner"
owner := "owner" //nolint:goconst // adding constants for this would impede readability
acc, err := NewContinuousLockingAccount(deps)
require.NoError(t, err)