diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bce1b6714..e80c876dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -324,9 +324,12 @@ jobs: - name: Go Lint uses: golangci/golangci-lint-action@v3 with: - version: v1.45.2 + # Keep pinned to a verson as sometimes updates will add new lint + # failures in unchanged code. + version: v1.50.1 working-directory: src - skip-cache: true + skip-pkg-cache: true + skip-build-cache: true # check licenses - name: Get go-licenses diff --git a/src/.golangci.yml b/src/.golangci.yml index ce971c2f9..db883efc4 100644 --- a/src/.golangci.yml +++ b/src/.golangci.yml @@ -1,7 +1,5 @@ run: - timeout: 15m - build-tags: - - testing + timeout: 20m linters: enable: @@ -15,6 +13,11 @@ linters: - revive - wsl + disable: + # Consumes a large amount of memory when running with Graph SDK in the + # project causing OOM failures in Github actions. + - staticcheck + linters-settings: gci: sections: diff --git a/src/Makefile b/src/Makefile index a5a365c34..775024811 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ # This must match the version defined in .github/workflows/lint.yaml. -WANTED_LINT_VERSION := 1.45.2 +WANTED_LINT_VERSION := 1.50.1 LINT_VERSION := $(shell golangci-lint version | cut -d' ' -f4) HAS_LINT := $(shell which golangci-lint) diff --git a/src/internal/common/time_test.go b/src/internal/common/time_test.go index 702919ecf..6d72b0e19 100644 --- a/src/internal/common/time_test.go +++ b/src/internal/common/time_test.go @@ -89,8 +89,6 @@ func (suite *CommonTimeUnitSuite) TestExtractTime() { parseT("2006-01-02T03:00:04-01:00"), } - type timeFormatter func(time.Time) string - formats := []common.TimeFormat{ common.ClippedSimple, common.ClippedSimpleOneDrive, diff --git a/src/internal/connector/data_collections_test.go b/src/internal/connector/data_collections_test.go index ee273ebd0..391e7c6b7 100644 --- a/src/internal/connector/data_collections_test.go +++ b/src/internal/connector/data_collections_test.go @@ -282,9 +282,7 @@ func (suite *ConnectorCreateExchangeCollectionIntegrationSuite) TestMailFetch() require.NotEmpty(t, c.FullPath().Folder()) folder := c.FullPath().Folder() - if _, ok := test.folderNames[folder]; ok { - delete(test.folderNames, folder) - } + delete(test.folderNames, folder) } assert.Empty(t, test.folderNames) @@ -369,7 +367,7 @@ func (suite *ConnectorCreateExchangeCollectionIntegrationSuite) TestContactSeria assert.NotZero(t, read) contact, err := support.CreateContactFromBytes(buf.Bytes()) assert.NotNil(t, contact) - assert.NoError(t, err, "error on converting contact bytes: "+string(buf.Bytes())) + assert.NoError(t, err, "error on converting contact bytes: "+buf.String()) count++ } assert.NotZero(t, count) @@ -434,7 +432,7 @@ func (suite *ConnectorCreateExchangeCollectionIntegrationSuite) TestEventsSerial assert.NotZero(t, read) event, err := support.CreateEventFromBytes(buf.Bytes()) assert.NotNil(t, event) - assert.NoError(t, err, "experienced error parsing event bytes: "+string(buf.Bytes())) + assert.NoError(t, err, "experienced error parsing event bytes: "+buf.String()) } status := connector.AwaitStatus() diff --git a/src/internal/connector/exchange/delta_get.go b/src/internal/connector/exchange/delta_get.go index 24c883617..5d026e37c 100644 --- a/src/internal/connector/exchange/delta_get.go +++ b/src/internal/connector/exchange/delta_get.go @@ -18,6 +18,7 @@ const ( // The following functions are based off the code in v0.41.0 of msgraph-sdk-go // for sending delta requests with query parameters. +//nolint:unused func createGetRequestInformationWithRequestConfiguration( baseRequestInfoFunc func() (*abs.RequestInformation, error), requestConfig *DeltaRequestBuilderGetRequestConfiguration, @@ -42,7 +43,7 @@ func createGetRequestInformationWithRequestConfiguration( return requestInfo, nil } -//nolint:deadcode +//nolint:unused func sendMessagesDeltaGet( ctx context.Context, m *msmaildelta.DeltaRequestBuilder, @@ -82,7 +83,7 @@ func sendMessagesDeltaGet( return res.(msmaildelta.DeltaResponseable), nil } -//nolint:deadcode +//nolint:unused func sendContactsDeltaGet( ctx context.Context, m *mscontactdelta.DeltaRequestBuilder, diff --git a/src/internal/connector/graph_connector_test.go b/src/internal/connector/graph_connector_test.go index 51310b78d..f5f11385d 100644 --- a/src/internal/connector/graph_connector_test.go +++ b/src/internal/connector/graph_connector_test.go @@ -233,7 +233,7 @@ func runRestoreBackupTest( assert.NotNil(t, deets) status := restoreGC.AwaitStatus() - runTime := time.Now().Sub(start) + runTime := time.Since(start) assert.Equal(t, totalItems, status.ObjectCount, "status.ObjectCount") assert.Equal(t, totalItems, status.Successful, "status.Successful") @@ -268,7 +268,7 @@ func runRestoreBackupTest( dcs, err := backupGC.DataCollections(ctx, backupSel) require.NoError(t, err) - t.Logf("Backup enumeration complete in %v\n", time.Now().Sub(start)) + t.Logf("Backup enumeration complete in %v\n", time.Since(start)) // Pull the data prior to waiting for the status as otherwise it will // deadlock. diff --git a/src/internal/connector/sharepoint/data_collections_test.go b/src/internal/connector/sharepoint/data_collections_test.go index fbb428f52..aed554867 100644 --- a/src/internal/connector/sharepoint/data_collections_test.go +++ b/src/internal/connector/sharepoint/data_collections_test.go @@ -1,7 +1,6 @@ package sharepoint_test import ( - "context" "testing" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" @@ -55,7 +54,6 @@ func (ms *MockGraphService) ErrPolicy() bool { type SharePointLibrariesSuite struct { suite.Suite - ctx context.Context } func TestSharePointLibrariesSuite(t *testing.T) { diff --git a/src/pkg/repository/repository_load_test.go b/src/pkg/repository/repository_load_test.go index f2864f2ef..b4d13312c 100644 --- a/src/pkg/repository/repository_load_test.go +++ b/src/pkg/repository/repository_load_test.go @@ -25,18 +25,22 @@ import ( "github.com/alcionai/corso/src/pkg/storage" ) +//nolint:unused func orgSiteSet(t *testing.T) []string { return tester.LoadTestM365OrgSites(t) } +//nolint:unused func orgUserSet(t *testing.T) []string { return tester.LoadTestM365OrgUsers(t) } +//nolint:unused func singleSiteSet(t *testing.T) []string { return []string{tester.LoadTestM365SiteID(t)} } +//nolint:unused func singleUserSet(t *testing.T) []string { return []string{tester.LoadTestM365UserID(t)} } @@ -368,8 +372,8 @@ type RepositoryLoadTestExchangeSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account - st storage.Storage + acct account.Account //nolint:unused + st storage.Storage //nolint:unused usersUnderTest []string } @@ -418,8 +422,8 @@ type RepositoryIndividualLoadTestExchangeSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account - st storage.Storage + acct account.Account //nolint:unused + st storage.Storage //nolint:unused usersUnderTest []string } @@ -471,8 +475,8 @@ type RepositoryLoadTestOneDriveSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account - st storage.Storage + acct account.Account //nolint:unused + st storage.Storage //nolint:unused usersUnderTest []string } @@ -518,8 +522,8 @@ type RepositoryIndividualLoadTestOneDriveSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account - st storage.Storage + acct account.Account //nolint:unused + st storage.Storage //nolint:unused usersUnderTest []string } @@ -569,8 +573,8 @@ type RepositoryLoadTestSharePointSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account - st storage.Storage + acct account.Account //nolint:unused + st storage.Storage //nolint:unused sitesUnderTest []string } @@ -616,8 +620,8 @@ type RepositoryIndividualLoadTestSharePointSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account - st storage.Storage + acct account.Account //nolint:unused + st storage.Storage //nolint:unused sitesUnderTest []string }