[chore] Upgrade to Go 1.24 (#4187)

* Set `go.mod` to 1.24 now that it's been out for 3 months.
* Update all the test to use `testing.T.Context()`.

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4187
Co-authored-by: Daenney <git@noreply.sourcery.dny.nu>
Co-committed-by: Daenney <git@noreply.sourcery.dny.nu>
This commit is contained in:
Daenney 2025-05-22 12:26:11 +02:00 committed by kim
commit d5c9c4adc1
175 changed files with 857 additions and 1004 deletions

View file

@ -39,7 +39,7 @@ func (suite *PollTestSuite) TestGetPollBy() {
t := suite.T()
// Create a new context for this test.
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
// Sentinel error to mark avoiding a test case.
@ -103,7 +103,7 @@ func (suite *PollTestSuite) TestGetPollVoteBy() {
t := suite.T()
// Create a new context for this test.
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
// Sentinel error to mark avoiding a test case.
@ -175,7 +175,7 @@ func (suite *PollTestSuite) TestGetPollVoteBy() {
func (suite *PollTestSuite) TestUpdatePoll() {
// Create a new context for this test.
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
for _, poll := range suite.testPolls {
@ -200,7 +200,7 @@ func (suite *PollTestSuite) TestUpdatePoll() {
func (suite *PollTestSuite) TestPutPoll() {
// Create a new context for this test.
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
for _, poll := range suite.testPolls {
@ -220,7 +220,7 @@ func (suite *PollTestSuite) TestPutPoll() {
func (suite *PollTestSuite) TestPutPollVote() {
// Create a new context for this test.
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
// randomChoices generates random vote choices in poll.
@ -271,7 +271,7 @@ func (suite *PollTestSuite) TestPutPollVote() {
func (suite *PollTestSuite) TestDeletePoll() {
// Create a new context for this test.
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
for _, poll := range suite.testPolls {
@ -286,7 +286,7 @@ func (suite *PollTestSuite) TestDeletePoll() {
}
func (suite *PollTestSuite) TestDeletePollVotesBy() {
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
for _, vote := range suite.testPollVotes {
@ -308,7 +308,7 @@ func (suite *PollTestSuite) TestDeletePollVotesBy() {
}
func (suite *PollTestSuite) TestDeletePollVotesByNoAccount() {
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
// Try to delete a poll by nonexisting account.