diff --git a/.github/workflows/node.test.yaml b/.github/workflows/node.test.yaml index 2c56b7532..884fad01a 100644 --- a/.github/workflows/node.test.yaml +++ b/.github/workflows/node.test.yaml @@ -58,8 +58,8 @@ jobs: run: | cd ./node go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest - go vet - go vet -vettool=$(which shadow) + go vet ./... + go vet -vettool=$(which shadow) ./... - name: Install golang-migrate run: | diff --git a/node/pkg/db/pgsql.go b/node/pkg/db/pgsql.go index 3261c7e1f..a9c57114f 100644 --- a/node/pkg/db/pgsql.go +++ b/node/pkg/db/pgsql.go @@ -44,27 +44,30 @@ func loadPgsqlConnectionString() string { } func Query(ctx context.Context, queryString string, args map[string]any) (pgx.Rows, error) { - pool, err := GetPool(ctx) + _pool, err := GetPool(ctx) if err != nil { return nil, err } + pool = _pool return query(pool, queryString, args) } func QueryRow[T any](ctx context.Context, queryString string, args map[string]any) (T, error) { var t T - pool, err := GetPool(ctx) + _pool, err := GetPool(ctx) if err != nil { return t, err } + pool = _pool return queryRow[T](pool, queryString, args) } func QueryRows[T any](ctx context.Context, queryString string, args map[string]any) ([]T, error) { - pool, err := GetPool(ctx) + _pool, err := GetPool(ctx) if err != nil { return nil, err } + pool = _pool return queryRows[T](pool, queryString, args) } diff --git a/node/pkg/db/redis.go b/node/pkg/db/redis.go index 4d2ca4b38..fbc77bc9b 100644 --- a/node/pkg/db/redis.go +++ b/node/pkg/db/redis.go @@ -46,37 +46,40 @@ func connectRdb(ctx context.Context) (*redis.Conn, error) { } func Set(ctx context.Context, key string, value string, exp time.Duration) error { - rdb, err := GetRedisConn(ctx) + _rdb, err := GetRedisConn(ctx) if err != nil { return err } + rdb = _rdb return setRedis(ctx, rdb, key, value, exp) } func Get(ctx context.Context, key string) (string, error) { - rdb, err := GetRedisConn(ctx) + _rdb, err := GetRedisConn(ctx) if err != nil { return "", err } + rdb = _rdb return getRedis(ctx, rdb, key) } func Del(ctx context.Context, key string) error { - rdb, err := GetRedisConn(ctx) + _rdb, err := GetRedisConn(ctx) if err != nil { return err } + rdb = _rdb return rdb.Del(ctx, key).Err() } func connectToRedis(ctx context.Context, connectionInfo RedisConnectionInfo) (*redis.Conn, error) { - rdb := redis.NewClient(&redis.Options{ + _rdb := redis.NewClient(&redis.Options{ Addr: connectionInfo.Host + ":" + connectionInfo.Port}).Conn() - _, rdbErr := rdb.Ping(ctx).Result() + _, rdbErr := _rdb.Ping(ctx).Result() if rdbErr != nil { return nil, rdbErr } - return rdb, nil + return _rdb, nil } func loadRedisConnectionString() (RedisConnectionInfo, error) { diff --git a/node/pkg/raft/raft.go b/node/pkg/raft/raft.go index b1d9f16bc..19a7d9a00 100644 --- a/node/pkg/raft/raft.go +++ b/node/pkg/raft/raft.go @@ -256,10 +256,10 @@ func (r *Raft) sendReplyVote(to string, voteGranted bool) error { } func (r *Raft) sendRequestVote() error { - RequestVoteMessage := RequestVoteMessage{ + requestVoteMessage := RequestVoteMessage{ Term: r.GetCurrentTerm(), } - marshalledRequestVoteMsg, err := json.Marshal(RequestVoteMessage) + marshalledRequestVoteMsg, err := json.Marshal(requestVoteMessage) if err != nil { return err }