fix(go): update to resolve linter errors (#3913)

This commit is contained in:
Gabe Kangas 2024-09-05 13:41:10 -07:00 committed by GitHub
parent 208fafaaab
commit 90b70612c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 21 deletions

View file

@ -28,7 +28,6 @@ linters:
- bodyclose - bodyclose
- dupl - dupl
- errcheck - errcheck
- exportloopref
- goconst - goconst
- godot - godot
- godox - godox
@ -49,7 +48,7 @@ linters:
- cyclop - cyclop
- gosimple - gosimple
- unused - unused
- exportloopref - copyloopvar
- gocritic - gocritic
- forbidigo - forbidigo
- unparam - unparam
@ -67,12 +66,6 @@ linters-settings:
# should ignore tests # should ignore tests
skip-tests: true skip-tests: true
gosimple:
# Select the Go version to target. The default is '1.13'.
go: '1.22'
# https://staticcheck.io/docs/options#checks
checks: ['all']
gocritic: gocritic:
disabled-checks: disabled-checks:
- ifElseChain - ifElseChain

View file

@ -45,8 +45,8 @@ func GetFederationFollowers(limit int, offset int) ([]models.Follower, int, erro
} }
followersResult, err := _datastore.GetQueries().GetFederationFollowersWithOffset(ctx, db.GetFederationFollowersWithOffsetParams{ followersResult, err := _datastore.GetQueries().GetFederationFollowersWithOffset(ctx, db.GetFederationFollowersWithOffsetParams{
Limit: int32(limit), Limit: limit,
Offset: int32(offset), Offset: offset,
}) })
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err

View file

@ -237,7 +237,7 @@ func GetOutbox(limit int, offset int) (vocab.ActivityStreamsOrderedCollection, e
orderedItems := streams.NewActivityStreamsOrderedItemsProperty() orderedItems := streams.NewActivityStreamsOrderedItemsProperty()
rows, err := _datastore.GetQueries().GetOutboxWithOffset( rows, err := _datastore.GetQueries().GetOutboxWithOffset(
context.Background(), context.Background(),
db.GetOutboxWithOffsetParams{Limit: int32(limit), Offset: int32(offset)}, db.GetOutboxWithOffsetParams{Limit: limit, Offset: offset},
) )
if err != nil { if err != nil {
return collection, err return collection, err
@ -309,8 +309,8 @@ func SaveInboundFediverseActivity(objectIRI string, actorIRI string, eventType s
func GetInboundActivities(limit int, offset int) ([]models.FederatedActivity, int, error) { func GetInboundActivities(limit int, offset int) ([]models.FederatedActivity, int, error) {
ctx := context.Background() ctx := context.Background()
rows, err := _datastore.GetQueries().GetInboundActivitiesWithOffset(ctx, db.GetInboundActivitiesWithOffsetParams{ rows, err := _datastore.GetQueries().GetInboundActivitiesWithOffset(ctx, db.GetInboundActivitiesWithOffsetParams{
Limit: int32(limit), Limit: limit,
Offset: int32(offset), Offset: offset,
}) })
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err

View file

@ -158,7 +158,7 @@ UPDATE users SET display_color = $1 WHERE id = $2
` `
type ChangeDisplayColorParams struct { type ChangeDisplayColorParams struct {
DisplayColor int32 DisplayColor int
ID string ID string
} }
@ -253,8 +253,8 @@ SELECT iri, inbox, name, username, image, created_at FROM ap_followers WHERE app
` `
type GetFederationFollowersWithOffsetParams struct { type GetFederationFollowersWithOffsetParams struct {
Limit int32 Limit int
Offset int32 Offset int
} }
type GetFederationFollowersWithOffsetRow struct { type GetFederationFollowersWithOffsetRow struct {
@ -365,8 +365,8 @@ SELECT iri, actor, type, timestamp FROM ap_accepted_activities ORDER BY timestam
` `
type GetInboundActivitiesWithOffsetParams struct { type GetInboundActivitiesWithOffsetParams struct {
Limit int32 Limit int
Offset int32 Offset int
} }
type GetInboundActivitiesWithOffsetRow struct { type GetInboundActivitiesWithOffsetRow struct {
@ -514,8 +514,8 @@ SELECT value FROM ap_outbox LIMIT $1 OFFSET $2
` `
type GetOutboxWithOffsetParams struct { type GetOutboxWithOffsetParams struct {
Limit int32 Limit int
Offset int32 Offset int
} }
func (q *Queries) GetOutboxWithOffset(ctx context.Context, arg GetOutboxWithOffsetParams) ([][]byte, error) { func (q *Queries) GetOutboxWithOffset(ctx context.Context, arg GetOutboxWithOffsetParams) ([][]byte, error) {

View file

@ -144,7 +144,7 @@ func (r *SqlUserRepository) ChangeUserColor(userID string, color int) error {
defer r.datastore.DbLock.Unlock() defer r.datastore.DbLock.Unlock()
if err := r.datastore.GetQueries().ChangeDisplayColor(context.Background(), db.ChangeDisplayColorParams{ if err := r.datastore.GetQueries().ChangeDisplayColor(context.Background(), db.ChangeDisplayColorParams{
DisplayColor: int32(color), DisplayColor: color,
ID: userID, ID: userID,
}); err != nil { }); err != nil {
return errors.Wrap(err, "unable to change display color") return errors.Wrap(err, "unable to change display color")