Use latest golangci-lint version (#1634)

## Description

Use latest golangci-lint version. Also updates cache flags.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [x] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

* #1629 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Vaibhav Kamra 2022-11-30 13:17:01 -08:00 committed by GitHub
parent bd373bbfd4
commit c4333ad531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 31 deletions

View File

@ -324,9 +324,12 @@ jobs:
- name: Go Lint - name: Go Lint
uses: golangci/golangci-lint-action@v3 uses: golangci/golangci-lint-action@v3
with: 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 working-directory: src
skip-cache: true skip-pkg-cache: true
skip-build-cache: true
# check licenses # check licenses
- name: Get go-licenses - name: Get go-licenses

View File

@ -1,7 +1,5 @@
run: run:
timeout: 15m timeout: 20m
build-tags:
- testing
linters: linters:
enable: enable:
@ -15,6 +13,11 @@ linters:
- revive - revive
- wsl - 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: linters-settings:
gci: gci:
sections: sections:

View File

@ -1,5 +1,5 @@
# This must match the version defined in .github/workflows/lint.yaml. # 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) LINT_VERSION := $(shell golangci-lint version | cut -d' ' -f4)
HAS_LINT := $(shell which golangci-lint) HAS_LINT := $(shell which golangci-lint)

View File

@ -89,8 +89,6 @@ func (suite *CommonTimeUnitSuite) TestExtractTime() {
parseT("2006-01-02T03:00:04-01:00"), parseT("2006-01-02T03:00:04-01:00"),
} }
type timeFormatter func(time.Time) string
formats := []common.TimeFormat{ formats := []common.TimeFormat{
common.ClippedSimple, common.ClippedSimple,
common.ClippedSimpleOneDrive, common.ClippedSimpleOneDrive,

View File

@ -282,9 +282,7 @@ func (suite *ConnectorCreateExchangeCollectionIntegrationSuite) TestMailFetch()
require.NotEmpty(t, c.FullPath().Folder()) require.NotEmpty(t, c.FullPath().Folder())
folder := 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) assert.Empty(t, test.folderNames)
@ -369,7 +367,7 @@ func (suite *ConnectorCreateExchangeCollectionIntegrationSuite) TestContactSeria
assert.NotZero(t, read) assert.NotZero(t, read)
contact, err := support.CreateContactFromBytes(buf.Bytes()) contact, err := support.CreateContactFromBytes(buf.Bytes())
assert.NotNil(t, contact) 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++ count++
} }
assert.NotZero(t, count) assert.NotZero(t, count)
@ -434,7 +432,7 @@ func (suite *ConnectorCreateExchangeCollectionIntegrationSuite) TestEventsSerial
assert.NotZero(t, read) assert.NotZero(t, read)
event, err := support.CreateEventFromBytes(buf.Bytes()) event, err := support.CreateEventFromBytes(buf.Bytes())
assert.NotNil(t, event) 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() status := connector.AwaitStatus()

View File

@ -18,6 +18,7 @@ const (
// The following functions are based off the code in v0.41.0 of msgraph-sdk-go // The following functions are based off the code in v0.41.0 of msgraph-sdk-go
// for sending delta requests with query parameters. // for sending delta requests with query parameters.
//nolint:unused
func createGetRequestInformationWithRequestConfiguration( func createGetRequestInformationWithRequestConfiguration(
baseRequestInfoFunc func() (*abs.RequestInformation, error), baseRequestInfoFunc func() (*abs.RequestInformation, error),
requestConfig *DeltaRequestBuilderGetRequestConfiguration, requestConfig *DeltaRequestBuilderGetRequestConfiguration,
@ -42,7 +43,7 @@ func createGetRequestInformationWithRequestConfiguration(
return requestInfo, nil return requestInfo, nil
} }
//nolint:deadcode //nolint:unused
func sendMessagesDeltaGet( func sendMessagesDeltaGet(
ctx context.Context, ctx context.Context,
m *msmaildelta.DeltaRequestBuilder, m *msmaildelta.DeltaRequestBuilder,
@ -82,7 +83,7 @@ func sendMessagesDeltaGet(
return res.(msmaildelta.DeltaResponseable), nil return res.(msmaildelta.DeltaResponseable), nil
} }
//nolint:deadcode //nolint:unused
func sendContactsDeltaGet( func sendContactsDeltaGet(
ctx context.Context, ctx context.Context,
m *mscontactdelta.DeltaRequestBuilder, m *mscontactdelta.DeltaRequestBuilder,

View File

@ -233,7 +233,7 @@ func runRestoreBackupTest(
assert.NotNil(t, deets) assert.NotNil(t, deets)
status := restoreGC.AwaitStatus() 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.ObjectCount, "status.ObjectCount")
assert.Equal(t, totalItems, status.Successful, "status.Successful") assert.Equal(t, totalItems, status.Successful, "status.Successful")
@ -268,7 +268,7 @@ func runRestoreBackupTest(
dcs, err := backupGC.DataCollections(ctx, backupSel) dcs, err := backupGC.DataCollections(ctx, backupSel)
require.NoError(t, err) 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 // Pull the data prior to waiting for the status as otherwise it will
// deadlock. // deadlock.

View File

@ -1,7 +1,6 @@
package sharepoint_test package sharepoint_test
import ( import (
"context"
"testing" "testing"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
@ -55,7 +54,6 @@ func (ms *MockGraphService) ErrPolicy() bool {
type SharePointLibrariesSuite struct { type SharePointLibrariesSuite struct {
suite.Suite suite.Suite
ctx context.Context
} }
func TestSharePointLibrariesSuite(t *testing.T) { func TestSharePointLibrariesSuite(t *testing.T) {

View File

@ -25,18 +25,22 @@ import (
"github.com/alcionai/corso/src/pkg/storage" "github.com/alcionai/corso/src/pkg/storage"
) )
//nolint:unused
func orgSiteSet(t *testing.T) []string { func orgSiteSet(t *testing.T) []string {
return tester.LoadTestM365OrgSites(t) return tester.LoadTestM365OrgSites(t)
} }
//nolint:unused
func orgUserSet(t *testing.T) []string { func orgUserSet(t *testing.T) []string {
return tester.LoadTestM365OrgUsers(t) return tester.LoadTestM365OrgUsers(t)
} }
//nolint:unused
func singleSiteSet(t *testing.T) []string { func singleSiteSet(t *testing.T) []string {
return []string{tester.LoadTestM365SiteID(t)} return []string{tester.LoadTestM365SiteID(t)}
} }
//nolint:unused
func singleUserSet(t *testing.T) []string { func singleUserSet(t *testing.T) []string {
return []string{tester.LoadTestM365UserID(t)} return []string{tester.LoadTestM365UserID(t)}
} }
@ -368,8 +372,8 @@ type RepositoryLoadTestExchangeSuite struct {
suite.Suite suite.Suite
ctx context.Context ctx context.Context
repo repository.Repository repo repository.Repository
acct account.Account acct account.Account //nolint:unused
st storage.Storage st storage.Storage //nolint:unused
usersUnderTest []string usersUnderTest []string
} }
@ -418,8 +422,8 @@ type RepositoryIndividualLoadTestExchangeSuite struct {
suite.Suite suite.Suite
ctx context.Context ctx context.Context
repo repository.Repository repo repository.Repository
acct account.Account acct account.Account //nolint:unused
st storage.Storage st storage.Storage //nolint:unused
usersUnderTest []string usersUnderTest []string
} }
@ -471,8 +475,8 @@ type RepositoryLoadTestOneDriveSuite struct {
suite.Suite suite.Suite
ctx context.Context ctx context.Context
repo repository.Repository repo repository.Repository
acct account.Account acct account.Account //nolint:unused
st storage.Storage st storage.Storage //nolint:unused
usersUnderTest []string usersUnderTest []string
} }
@ -518,8 +522,8 @@ type RepositoryIndividualLoadTestOneDriveSuite struct {
suite.Suite suite.Suite
ctx context.Context ctx context.Context
repo repository.Repository repo repository.Repository
acct account.Account acct account.Account //nolint:unused
st storage.Storage st storage.Storage //nolint:unused
usersUnderTest []string usersUnderTest []string
} }
@ -569,8 +573,8 @@ type RepositoryLoadTestSharePointSuite struct {
suite.Suite suite.Suite
ctx context.Context ctx context.Context
repo repository.Repository repo repository.Repository
acct account.Account acct account.Account //nolint:unused
st storage.Storage st storage.Storage //nolint:unused
sitesUnderTest []string sitesUnderTest []string
} }
@ -616,8 +620,8 @@ type RepositoryIndividualLoadTestSharePointSuite struct {
suite.Suite suite.Suite
ctx context.Context ctx context.Context
repo repository.Repository repo repository.Repository
acct account.Account acct account.Account //nolint:unused
st storage.Storage st storage.Storage //nolint:unused
sitesUnderTest []string sitesUnderTest []string
} }