Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Use latest golangci-lint version (#1634)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
vkamra authored Nov 30, 2022
1 parent bd373bb commit c4333ad
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 31 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
run:
timeout: 15m
build-tags:
- testing
timeout: 20m

linters:
enable:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 0 additions & 2 deletions src/internal/common/time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 3 additions & 5 deletions src/internal/connector/data_collections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions src/internal/connector/exchange/delta_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -42,7 +43,7 @@ func createGetRequestInformationWithRequestConfiguration(
return requestInfo, nil
}

//nolint:deadcode
//nolint:unused
func sendMessagesDeltaGet(
ctx context.Context,
m *msmaildelta.DeltaRequestBuilder,
Expand Down Expand Up @@ -82,7 +83,7 @@ func sendMessagesDeltaGet(
return res.(msmaildelta.DeltaResponseable), nil
}

//nolint:deadcode
//nolint:unused
func sendContactsDeltaGet(
ctx context.Context,
m *mscontactdelta.DeltaRequestBuilder,
Expand Down
4 changes: 2 additions & 2 deletions src/internal/connector/graph_connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions src/internal/connector/sharepoint/data_collections_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package sharepoint_test

import (
"context"
"testing"

msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
Expand Down Expand Up @@ -55,7 +54,6 @@ func (ms *MockGraphService) ErrPolicy() bool {

type SharePointLibrariesSuite struct {
suite.Suite
ctx context.Context
}

func TestSharePointLibrariesSuite(t *testing.T) {
Expand Down
28 changes: 16 additions & 12 deletions src/pkg/repository/repository_load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit c4333ad

Please sign in to comment.