MM-57245: Bump up Go version to 1.21 (#26512)

* MM-57245: Bump up Go version to 1.21

https://mattermost.atlassian.net/browse/MM-57245
```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2024-03-21 09:12:35 +05:30
коммит произвёл GitHub
родитель 1dc5c006f2
Коммит 5e851f708b
38 изменённых файлов: 1151 добавлений и 1142 удалений

Просмотреть файл

@@ -28,7 +28,7 @@ func (s *MmctlUnitTestSuite) TestBotCreateCmd() {
s.client.
EXPECT().
CreateBot(context.Background(), &mockBot).
CreateBot(context.TODO(), &mockBot).
Return(&mockBot, &model.Response{}, nil).
Times(1)
@@ -52,25 +52,25 @@ func (s *MmctlUnitTestSuite) TestBotCreateCmd() {
s.client.
EXPECT().
CreateBot(context.Background(), &mockBot).
CreateBot(context.TODO(), &mockBot).
Return(&mockBot, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(model.UserFromBot(&mockBot), &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
CreateUserAccessToken(context.Background(), mockBot.UserId, "autogenerated").
CreateUserAccessToken(context.TODO(), mockBot.UserId, "autogenerated").
Return(&mockToken, &model.Response{}, nil).
Times(1)
@@ -89,7 +89,7 @@ func (s *MmctlUnitTestSuite) TestBotCreateCmd() {
s.client.
EXPECT().
CreateBot(context.Background(), &mockBot).
CreateBot(context.TODO(), &mockBot).
Return(nil, &model.Response{}, errors.New("some-error")).
Times(1)
@@ -118,19 +118,19 @@ func (s *MmctlUnitTestSuite) TestBotUpdateCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
PatchBot(context.Background(), mockUser.Id, gomock.Any()).
PatchBot(context.TODO(), mockUser.Id, gomock.Any()).
Return(&mockBot, &model.Response{}, nil).
Times(1)
@@ -150,19 +150,19 @@ func (s *MmctlUnitTestSuite) TestBotUpdateCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUser(context.Background(), botArg, "").
GetUser(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -185,19 +185,19 @@ func (s *MmctlUnitTestSuite) TestBotUpdateCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
PatchBot(context.Background(), mockUser.Id, gomock.Any()).
PatchBot(context.TODO(), mockUser.Id, gomock.Any()).
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -221,13 +221,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBotsIncludeDeleted(context.Background(), 0, 200, "").
GetBotsIncludeDeleted(context.TODO(), 0, 200, "").
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
Return([]*model.User{&mockUser}, &model.Response{}, nil).
Times(1)
@@ -247,7 +247,7 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBotsIncludeDeleted(context.Background(), 0, 200, "").
GetBotsIncludeDeleted(context.TODO(), 0, 200, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -269,13 +269,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBotsOrphaned(context.Background(), 0, 200, "").
GetBotsOrphaned(context.TODO(), 0, 200, "").
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
Return([]*model.User{&mockUser}, &model.Response{}, nil).
Times(1)
@@ -295,7 +295,7 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBotsOrphaned(context.Background(), 0, 200, "").
GetBotsOrphaned(context.TODO(), 0, 200, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -317,13 +317,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBots(context.Background(), 0, 200, "").
GetBots(context.TODO(), 0, 200, "").
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
Return([]*model.User{&mockUser}, &model.Response{}, nil).
Times(1)
@@ -344,13 +344,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBots(context.Background(), 0, 200, "").
GetBots(context.TODO(), 0, 200, "").
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
Return([]*model.User{}, &model.Response{}, nil).
Times(1)
@@ -370,7 +370,7 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBots(context.Background(), 0, 200, "").
GetBots(context.TODO(), 0, 200, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -391,13 +391,13 @@ func (s *MmctlUnitTestSuite) TestBotListCmd() {
s.client.
EXPECT().
GetBots(context.Background(), 0, 200, "").
GetBots(context.TODO(), 0, 200, "").
Return([]*model.Bot{&mockBot}, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUsersByIds(context.Background(), []string{mockBot.OwnerId}).
GetUsersByIds(context.TODO(), []string{mockBot.OwnerId}).
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -419,19 +419,19 @@ func (s *MmctlUnitTestSuite) TestBotDisableCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
DisableBot(context.Background(), mockUser.Id).
DisableBot(context.TODO(), mockUser.Id).
Return(&mockBot, &model.Response{}, nil).
Times(1)
@@ -448,19 +448,19 @@ func (s *MmctlUnitTestSuite) TestBotDisableCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUser(context.Background(), botArg, "").
GetUser(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -483,19 +483,19 @@ func (s *MmctlUnitTestSuite) TestBotDisableCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
DisableBot(context.Background(), mockUser.Id).
DisableBot(context.TODO(), mockUser.Id).
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -517,19 +517,19 @@ func (s *MmctlUnitTestSuite) TestBotEnableCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
EnableBot(context.Background(), mockUser.Id).
EnableBot(context.TODO(), mockUser.Id).
Return(&mockBot, &model.Response{}, nil).
Times(1)
@@ -546,19 +546,19 @@ func (s *MmctlUnitTestSuite) TestBotEnableCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUser(context.Background(), botArg, "").
GetUser(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -581,19 +581,19 @@ func (s *MmctlUnitTestSuite) TestBotEnableCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
EnableBot(context.Background(), mockUser.Id).
EnableBot(context.TODO(), mockUser.Id).
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -617,31 +617,31 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockBotUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUserByEmail(context.Background(), userArg, "").
GetUserByEmail(context.TODO(), userArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), userArg, "").
GetUserByUsername(context.TODO(), userArg, "").
Return(&mockNewOwner, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
AssignBot(context.Background(), mockBotUser.Id, mockNewOwner.Id).
AssignBot(context.TODO(), mockBotUser.Id, mockNewOwner.Id).
Return(&mockBot, &model.Response{}, nil).
Times(1)
@@ -659,19 +659,19 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUser(context.Background(), botArg, "").
GetUser(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -691,31 +691,31 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockBotUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), userArg, "").
GetUserByUsername(context.TODO(), userArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUser(context.Background(), userArg, "").
GetUser(context.TODO(), userArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByEmail(context.Background(), userArg, "").
GetUserByEmail(context.TODO(), userArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
@@ -736,31 +736,31 @@ func (s *MmctlUnitTestSuite) TestBotAssignCmd() {
s.client.
EXPECT().
GetUserByEmail(context.Background(), botArg, "").
GetUserByEmail(context.TODO(), botArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), botArg, "").
GetUserByUsername(context.TODO(), botArg, "").
Return(&mockBotUser, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
GetUserByEmail(context.Background(), userArg, "").
GetUserByEmail(context.TODO(), userArg, "").
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)
s.client.
EXPECT().
GetUserByUsername(context.Background(), userArg, "").
GetUserByUsername(context.TODO(), userArg, "").
Return(&mockNewOwner, &model.Response{}, nil).
Times(1)
s.client.
EXPECT().
AssignBot(context.Background(), mockBotUser.Id, mockNewOwner.Id).
AssignBot(context.TODO(), mockBotUser.Id, mockNewOwner.Id).
Return(nil, &model.Response{}, errors.New("mock error")).
Times(1)