From 0dfb1b1d4d8a97cc51a594dc316baa82fcd616e8 Mon Sep 17 00:00:00 2001 From: neha-Gupta1 Date: Thu, 24 Aug 2023 16:52:33 +0530 Subject: [PATCH] lint changes --- src/pkg/services/m365/api/channels.go | 16 ++++++---------- src/pkg/services/m365/api/channels_pager_test.go | 9 +++++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/pkg/services/m365/api/channels.go b/src/pkg/services/m365/api/channels.go index f530733eb..6fc13c2ce 100644 --- a/src/pkg/services/m365/api/channels.go +++ b/src/pkg/services/m365/api/channels.go @@ -5,14 +5,15 @@ import ( "fmt" "github.com/alcionai/clues" + "github.com/microsoft/kiota-abstractions-go/serialization" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/teams" + "github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/m365/graph" "github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/fault" "github.com/alcionai/corso/src/pkg/logger" - "github.com/microsoft/kiota-abstractions-go/serialization" - "github.com/microsoftgraph/msgraph-sdk-go/models" - "github.com/microsoftgraph/msgraph-sdk-go/teams" ) // --------------------------------------------------------------------------- @@ -76,7 +77,6 @@ func (c Channels) GetChannelByName( ByTeamId(teamID). Channels(). Get(ctx, options) - if err != nil { return nil, graph.Stack(ctx, err).WithClues(ctx) } @@ -110,9 +110,7 @@ func (c Channels) GetMessage( teamID, channelID, itemID string, errs *fault.Bus, ) (serialization.Parsable, *details.GroupsInfo, error) { - var ( - size int64 - ) + var size int64 message, err := c.Stable. Client(). @@ -161,9 +159,7 @@ func (c Channels) GetReplies( // --------------------------------------------------------------------------- func ChannelMessageInfo(msg models.ChatMessageable, size int64) *details.GroupsInfo { - var ( - created = ptr.Val(msg.GetCreatedDateTime()) - ) + created := ptr.Val(msg.GetCreatedDateTime()) return &details.GroupsInfo{ ItemType: details.TeamsChannelMessage, diff --git a/src/pkg/services/m365/api/channels_pager_test.go b/src/pkg/services/m365/api/channels_pager_test.go index b3618204d..1d5a5bdc2 100644 --- a/src/pkg/services/m365/api/channels_pager_test.go +++ b/src/pkg/services/m365/api/channels_pager_test.go @@ -4,11 +4,12 @@ import ( "testing" "github.com/alcionai/clues" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" + "github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/internal/tester/tconfig" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/suite" ) type ChannelPagerIntgSuite struct { @@ -59,7 +60,7 @@ func (suite *ChannelPagerIntgSuite) TestChannels_Get() { assert.NoError(t, err, clues.ToCore(err)) assert.Equal(t, ptr.Val(channel.GetDisplayName()), containerName) - // GET channel -should not be found anymore + // GET channel -should be found _, err = chanClient.GetChannel(ctx, teamID, ptr.Val(channel.GetId())) - assert.Error(t, err, clues.ToCore(err)) + assert.NoError(t, err, clues.ToCore(err)) }