Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade and placate golangci-lint #746

Merged
merged 1 commit into from
Sep 20, 2024
Merged

upgrade and placate golangci-lint #746

merged 1 commit into from
Sep 20, 2024

Conversation

lieut-data
Copy link
Member

Summary

After a Go upgrade, I ran into issues with golangci-lint, which in tun required upgrading that tooling.

Ticket Link

None.

@lieut-data lieut-data marked this pull request as ready for review September 19, 2024 18:38
@@ -802,7 +821,7 @@ func (s *SQLStore) getActiveUsersCount(db sq.BaseRunner, dur time.Duration) (act

//db:withReplica
func (s *SQLStore) getConnectedUsers(db sq.BaseRunner, page, perPage int) ([]*storemodels.ConnectedUser, error) {
query := s.getQueryBuilder(db).Select("mmuserid, msteamsuserid, Users.FirstName, Users.LastName, Users.Email").From(usersTableName).LeftJoin("Users ON Users.Id = msteamssync_users.mmuserid").Where(sq.NotEq{"token": ""}).OrderBy("Users.FirstName").Offset(uint64(page * perPage)).Limit(uint64(perPage))
query := s.getQueryBuilder(db).Select("mmuserid, msteamsuserid, Users.FirstName, Users.LastName, Users.Email").From(usersTableName).LeftJoin("Users ON Users.Id = msteamssync_users.mmuserid").Where(sq.NotEq{"token": ""}).OrderBy("Users.FirstName").Offset(offset(page, perPage)).Limit(limit(perPage))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior to this change, gosec was reporting:

G115: integer overflow conversion int -> uint64

Open to suggestions on handling this more cleanly!

@agnivade
Copy link
Member

We also need to do this on the server side.

@@ -54,6 +54,25 @@ func New(db, replica *sql.DB, api plugin.API, encryptionKey func() []byte) *SQLS
}
}

// offset is a helper function to make golangci-lint happy.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣

@lieut-data lieut-data merged commit bda2b60 into main Sep 20, 2024
9 checks passed
@lieut-data lieut-data deleted the upgrade-golangci-lint branch September 20, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants