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
- dupl
- errcheck
- exportloopref
- goconst
- godot
- godox
@ -49,7 +48,7 @@ linters:
- cyclop
- gosimple
- unused
- exportloopref
- copyloopvar
- gocritic
- forbidigo
- unparam
@ -67,12 +66,6 @@ linters-settings:
# should ignore tests
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:
disabled-checks:
- 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{
Limit: int32(limit),
Offset: int32(offset),
Limit: limit,
Offset: offset,
})
if err != nil {
return nil, 0, err

View file

@ -237,7 +237,7 @@ func GetOutbox(limit int, offset int) (vocab.ActivityStreamsOrderedCollection, e
orderedItems := streams.NewActivityStreamsOrderedItemsProperty()
rows, err := _datastore.GetQueries().GetOutboxWithOffset(
context.Background(),
db.GetOutboxWithOffsetParams{Limit: int32(limit), Offset: int32(offset)},
db.GetOutboxWithOffsetParams{Limit: limit, Offset: offset},
)
if err != nil {
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) {
ctx := context.Background()
rows, err := _datastore.GetQueries().GetInboundActivitiesWithOffset(ctx, db.GetInboundActivitiesWithOffsetParams{
Limit: int32(limit),
Offset: int32(offset),
Limit: limit,
Offset: offset,
})
if err != nil {
return nil, 0, err

View file

@ -158,7 +158,7 @@ UPDATE users SET display_color = $1 WHERE id = $2
`
type ChangeDisplayColorParams struct {
DisplayColor int32
DisplayColor int
ID string
}
@ -253,8 +253,8 @@ SELECT iri, inbox, name, username, image, created_at FROM ap_followers WHERE app
`
type GetFederationFollowersWithOffsetParams struct {
Limit int32
Offset int32
Limit int
Offset int
}
type GetFederationFollowersWithOffsetRow struct {
@ -365,8 +365,8 @@ SELECT iri, actor, type, timestamp FROM ap_accepted_activities ORDER BY timestam
`
type GetInboundActivitiesWithOffsetParams struct {
Limit int32
Offset int32
Limit int
Offset int
}
type GetInboundActivitiesWithOffsetRow struct {
@ -514,8 +514,8 @@ SELECT value FROM ap_outbox LIMIT $1 OFFSET $2
`
type GetOutboxWithOffsetParams struct {
Limit int32
Offset int32
Limit int
Offset int
}
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()
if err := r.datastore.GetQueries().ChangeDisplayColor(context.Background(), db.ChangeDisplayColorParams{
DisplayColor: int32(color),
DisplayColor: color,
ID: userID,
}); err != nil {
return errors.Wrap(err, "unable to change display color")