[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
parent ec4d4d0115
commit d5c9c4adc1
175 changed files with 857 additions and 1004 deletions

View File

@@ -51,7 +51,7 @@ func (suite *AccountTestSuite) TestDereferenceGroup() {
groupURL := testrig.URLMustParse("https://unknown-instance.com/groups/some_group")
group, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
groupURL,
false,
@@ -65,7 +65,7 @@ func (suite *AccountTestSuite) TestDereferenceGroup() {
suite.WithinDuration(time.Now(), group.FetchedAt, 5*time.Second)
// group should be in the database
dbGroup, err := suite.db.GetAccountByURI(context.Background(), group.URI)
dbGroup, err := suite.db.GetAccountByURI(suite.T().Context(), group.URI)
suite.NoError(err)
suite.Equal(group.ID, dbGroup.ID)
suite.Equal(ap.ActorGroup, dbGroup.ActorType.String())
@@ -76,7 +76,7 @@ func (suite *AccountTestSuite) TestDereferenceService() {
serviceURL := testrig.URLMustParse("https://owncast.example.org/federation/user/rgh")
service, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
serviceURL,
false,
@@ -90,7 +90,7 @@ func (suite *AccountTestSuite) TestDereferenceService() {
suite.WithinDuration(time.Now(), service.FetchedAt, 5*time.Second)
// service should be in the database
dbService, err := suite.db.GetAccountByURI(context.Background(), service.URI)
dbService, err := suite.db.GetAccountByURI(suite.T().Context(), service.URI)
suite.NoError(err)
suite.Equal(service.ID, dbService.ID)
suite.Equal(ap.ActorService, dbService.ActorType.String())
@@ -109,7 +109,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountAsRemoteURL() {
targetAccount := suite.testAccounts["local_account_2"]
fetchedAccount, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
testrig.URLMustParse(targetAccount.URI),
false,
@@ -124,12 +124,12 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountAsRemoteURLNoSharedInb
targetAccount := suite.testAccounts["local_account_2"]
targetAccount.SharedInboxURI = nil
if err := suite.db.UpdateAccount(context.Background(), targetAccount); err != nil {
if err := suite.db.UpdateAccount(suite.T().Context(), targetAccount); err != nil {
suite.FailNow(err.Error())
}
fetchedAccount, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
testrig.URLMustParse(targetAccount.URI),
false,
@@ -144,7 +144,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountAsUsername() {
targetAccount := suite.testAccounts["local_account_2"]
fetchedAccount, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
testrig.URLMustParse(targetAccount.URI),
false,
@@ -159,7 +159,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountAsUsernameDomain() {
targetAccount := suite.testAccounts["local_account_2"]
fetchedAccount, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
testrig.URLMustParse(targetAccount.URI),
false,
@@ -174,7 +174,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountAsUsernameDomainAndURL
targetAccount := suite.testAccounts["local_account_2"]
fetchedAccount, _, err := suite.dereferencer.GetAccountByUsernameDomain(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
targetAccount.Username,
config.GetHost(),
@@ -188,7 +188,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountWithUnknownUsername()
fetchingAccount := suite.testAccounts["local_account_1"]
fetchedAccount, _, err := suite.dereferencer.GetAccountByUsernameDomain(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
"thisaccountdoesnotexist",
config.GetHost(),
@@ -202,7 +202,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountWithUnknownUsernameDom
fetchingAccount := suite.testAccounts["local_account_1"]
fetchedAccount, _, err := suite.dereferencer.GetAccountByUsernameDomain(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
"thisaccountdoesnotexist",
"localhost:8080",
@@ -216,7 +216,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountWithUnknownUserURI() {
fetchingAccount := suite.testAccounts["local_account_1"]
fetchedAccount, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
testrig.URLMustParse("http://localhost:8080/users/thisaccountdoesnotexist"),
false,
@@ -227,7 +227,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountWithUnknownUserURI() {
}
func (suite *AccountTestSuite) TestDereferenceLocalAccountByRedirect() {
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
fetchingAccount := suite.testAccounts["local_account_1"]
@@ -280,7 +280,7 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountByRedirect() {
}
func (suite *AccountTestSuite) TestDereferenceMasqueradingLocalAccount() {
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
fetchingAccount := suite.testAccounts["local_account_1"]
@@ -345,7 +345,7 @@ func (suite *AccountTestSuite) TestDereferenceRemoteAccountWithNonMatchingURI()
// Attempt to fetch account at alternative URI, it should fail!
fetchedAccount, _, err := suite.dereferencer.GetAccountByURI(
context.Background(),
suite.T().Context(),
fetchingAccount.Username,
testrig.URLMustParse(remoteAltURI),
false,
@@ -355,7 +355,7 @@ func (suite *AccountTestSuite) TestDereferenceRemoteAccountWithNonMatchingURI()
}
func (suite *AccountTestSuite) TestDereferenceRemoteAccountWithUnexpectedKeyChange() {
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
fetchingAcc := suite.testAccounts["local_account_1"]
@@ -394,7 +394,7 @@ func (suite *AccountTestSuite) TestDereferenceRemoteAccountWithUnexpectedKeyChan
}
func (suite *AccountTestSuite) TestDereferenceRemoteAccountWithExpectedKeyChange() {
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
fetchingAcc := suite.testAccounts["local_account_1"]
@@ -436,7 +436,7 @@ func (suite *AccountTestSuite) TestDereferenceRemoteAccountWithExpectedKeyChange
}
func (suite *AccountTestSuite) TestRefreshFederatedRemoteAccountWithKeyChange() {
ctx, cncl := context.WithCancel(context.Background())
ctx, cncl := context.WithCancel(suite.T().Context())
defer cncl()
fetchingAcc := suite.testAccounts["local_account_1"]