Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

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

Gabe Kangasbdb598a2acdf
diff --git a/.golangci.yml b/.golangci.yml
index a12706bf9b..ebf441a1cf 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -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
diff --git a/activitypub/persistence/followers.go b/activitypub/persistence/followers.go
index 7d9e1298b8..27266de77d 100644
--- a/activitypub/persistence/followers.go
+++ b/activitypub/persistence/followers.go
@@ -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
diff --git a/activitypub/persistence/persistence.go b/activitypub/persistence/persistence.go
index 64ec39998c..e83933e939 100644
--- a/activitypub/persistence/persistence.go
+++ b/activitypub/persistence/persistence.go
@@ -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
diff --git a/db/query.sql.go b/db/query.sql.go
index b42e42ee7f..967b34fd90 100644
--- a/db/query.sql.go
+++ b/db/query.sql.go
@@ -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) {
diff --git a/persistence/userrepository/userrepository.go b/persistence/userrepository/userrepository.go
index 7d3905418c..b31cb37d03 100644
--- a/persistence/userrepository/userrepository.go
+++ b/persistence/userrepository/userrepository.go
@@ -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")