Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "CLOUDP-300869: Upgrade golangci to v1.64.5 (#3656)" #3667

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837
with:
version: v1.64.5
version: v1.61.0
unit-tests:
env:
COVERAGE: coverage.out
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ linters:
- rowserrcheck # checks whether Err of rows is checked successfully [fast: false, auto-fix: false]
- staticcheck # (megacheck) It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary. The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint. [fast: false, auto-fix: false]
- stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false]
- tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false]
- testableexamples # linter checks if examples are testable (have an expected output)
- testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false]
- thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false]
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false, auto-fix: false]
- unconvert # Remove unnecessary type conversions [fast: false, auto-fix: false]
- unparam # Reports unused function parameters [fast: false, auto-fix: false]
- unused # (megacheck) Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
- usetesting # Reports uses of functions with replacement inside the testing package.
- usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false]
- wastedassign # wastedassign finds wasted assignment statements. [fast: false, auto-fix: false]
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html

GOLANGCI_VERSION=v1.64.5
GOLANGCI_VERSION=v1.61.0
COVERAGE?=coverage.out
GOCOVERDIR?=$(abspath cov)

Expand Down
4 changes: 2 additions & 2 deletions build/ci/evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ include:

variables:
- &go_linux_version
go_root: "/opt/golang/go1.24"
go_bin: "/opt/golang/go1.24/bin"
go_root: "/opt/golang/go1.23"
go_bin: "/opt/golang/go1.23/bin"
go_base_path: ""
- &go_env
XDG_CONFIG_HOME: ${go_base_path}${workdir}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mongodb/mongodb-atlas-cli/atlascli

go 1.24.0
go 1.23.6

require (
cloud.google.com/go/kms v1.20.5
Expand Down
2 changes: 1 addition & 1 deletion internal/api/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ func TestWatchInner(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := t.Context()
ctx := context.Background()
result, err := watchInner(ctx, tt.executor, tt.expect, tt.commandRequest)

// Check error
Expand Down
3 changes: 2 additions & 1 deletion internal/cli/auth/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package auth

import (
"bytes"
"context"
"errors"
"fmt"
"testing"
Expand Down Expand Up @@ -88,7 +89,7 @@ func Test_loginOpts_Run(t *testing.T) {
ExpiresIn: 300,
Interval: 10,
}
ctx := t.Context()
ctx := context.TODO()
mockFlow.
EXPECT().
RequestCode(ctx).
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/auth/logout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package auth

import (
"bytes"
"context"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -41,7 +42,7 @@ func Test_logoutOpts_Run(t *testing.T) {
Confirm: true,
},
}
ctx := t.Context()
ctx := context.TODO()
mockFlow.
EXPECT().
RevokeToken(ctx, gomock.Any(), gomock.Any()).
Expand Down Expand Up @@ -71,7 +72,7 @@ func Test_logoutOpts_Run_Keep(t *testing.T) {
},
keepConfig: true,
}
ctx := t.Context()
ctx := context.TODO()
mockFlow.
EXPECT().
RevokeToken(ctx, gomock.Any(), gomock.Any()).
Expand Down
3 changes: 2 additions & 1 deletion internal/cli/auth/register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package auth

import (
"bytes"
"context"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -36,7 +37,7 @@ func Test_registerOpts_Run(t *testing.T) {
mockStore := mocks.NewMockProjectOrgsLister(ctrl)

buf := new(bytes.Buffer)
ctx := t.Context()
ctx := context.TODO()

opts := &RegisterOpts{}
opts.NoBrowser = true
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/clusters/watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package clusters

import (
"context"
"testing"

"github.com/golang/mock/gomock"
Expand Down Expand Up @@ -45,7 +46,7 @@ func TestWatch_Run(t *testing.T) {
Return(expected, nil).
Times(1)

require.NoError(t, opts.Run(t.Context()))
require.NoError(t, opts.Run(context.Background()))
}

func TestWatch_Run_FlexCluster(t *testing.T) {
Expand All @@ -66,5 +67,5 @@ func TestWatch_Run_FlexCluster(t *testing.T) {
Return(expected, nil).
Times(1)

require.NoError(t, opts.Run(t.Context()))
require.NoError(t, opts.Run(context.Background()))
}
2 changes: 1 addition & 1 deletion internal/cli/datafederation/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestLogOpts_Run(t *testing.T) {

const contents = "expected"

file, err := os.CreateTemp(t.TempDir(), "")
file, err := os.CreateTemp("", "")
if err != nil {
require.NoError(t, err)
}
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/deployments/connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployments

import (
"bytes"
"context"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -37,7 +38,7 @@ const (

func TestRun_ConnectLocal(t *testing.T) {
ctrl := gomock.NewController(t)
ctx := t.Context()
ctx := context.Background()
buf := new(bytes.Buffer)

deploymenTest := fixture.NewMockLocalDeploymentOpts(ctrl, expectedLocalDeployment)
Expand Down Expand Up @@ -86,7 +87,7 @@ func TestRun_ConnectLocal(t *testing.T) {

func TestRun_ConnectAtlas(t *testing.T) {
ctrl := gomock.NewController(t)
ctx := t.Context()
ctx := context.Background()
buf := new(bytes.Buffer)

mockAtlasClusterDescriberStarter := mocks.NewMockClusterDescriberStarter(ctrl)
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/deployments/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployments

import (
"bytes"
"context"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -29,7 +30,7 @@ import (
func TestDelete_Run_Atlas(t *testing.T) {
ctrl := gomock.NewController(t)
mockAtlasStore := mocks.NewMockClusterDeleter(ctrl)
ctx := t.Context()
ctx := context.Background()

deploymentsTest := fixture.NewMockAtlasDeploymentOpts(ctrl, "atlasDeployment")

Expand Down Expand Up @@ -64,7 +65,7 @@ func TestDelete_Run_Atlas(t *testing.T) {

func TestDelete_Run_Local(t *testing.T) {
ctrl := gomock.NewController(t)
ctx := t.Context()
ctx := context.Background()
buf := new(bytes.Buffer)

deploymentsTest := fixture.NewMockLocalDeploymentOpts(ctrl, "testDeployment")
Expand Down
7 changes: 4 additions & 3 deletions internal/cli/deployments/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployments

import (
"bytes"
"context"
"errors"
"testing"

Expand All @@ -40,7 +41,7 @@ func TestList_Run(t *testing.T) {
mockCredentialsGetter := mocks.NewMockCredentialsGetter(ctrl)
mockProfileReader := mocks.NewMockProfileReader(ctrl)
mockContainerEngine := mocks.NewMockEngine(ctrl)
ctx := t.Context()
ctx := context.Background()

cli.TokenRefreshed = true
t.Cleanup(func() {
Expand Down Expand Up @@ -147,7 +148,7 @@ func TestList_Run_NoLocal(t *testing.T) {
mockCredentialsGetter := mocks.NewMockCredentialsGetter(ctrl)
mockProfileReader := mocks.NewMockProfileReader(ctrl)
mockContainerEngine := mocks.NewMockEngine(ctrl)
ctx := t.Context()
ctx := context.Background()

cli.TokenRefreshed = true
t.Cleanup(func() {
Expand Down Expand Up @@ -239,7 +240,7 @@ func TestList_Run_NoAtlas(t *testing.T) {
mockCredentialsGetter := mocks.NewMockCredentialsGetter(ctrl)
mockProfileReader := mocks.NewMockProfileReader(ctrl)
mockContainerEngine := mocks.NewMockEngine(ctrl)
ctx := t.Context()
ctx := context.Background()

cli.TokenRefreshed = true
t.Cleanup(func() {
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/deployments/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployments

import (
"bytes"
"context"
"encoding/base64"
"io"
"strings"
Expand All @@ -32,7 +33,7 @@ import (

func TestLogs_RunLocal(t *testing.T) {
ctrl := gomock.NewController(t)
ctx := t.Context()
ctx := context.Background()
buf := new(bytes.Buffer)
expectedLocalDeployment := "localDeployment"
deploymentTest := fixture.NewMockLocalDeploymentOpts(ctrl, expectedLocalDeployment)
Expand Down Expand Up @@ -65,7 +66,7 @@ func TestLogs_RunLocal(t *testing.T) {

func TestLogs_RunAtlas(t *testing.T) {
ctrl := gomock.NewController(t)
ctx := t.Context()
ctx := context.Background()
atlasDeployment := "localDeployment1"
mockStore := mocks.NewMockLogsDownloader(ctrl)
deploymentTest := fixture.NewMockAtlasDeploymentOpts(ctrl, atlasDeployment)
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/deployments/pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package deployments

import (
"bytes"
"context"
"fmt"
"testing"

Expand All @@ -38,7 +39,7 @@ const (
func TestPause_RunLocal(t *testing.T) {
ctrl := gomock.NewController(t)
deploymentTest := fixture.NewMockLocalDeploymentOpts(ctrl, deploymentName)
ctx := t.Context()
ctx := context.Background()

buf := new(bytes.Buffer)
pauseOpts := &PauseOpts{
Expand Down Expand Up @@ -74,7 +75,7 @@ func TestPause_RunLocal(t *testing.T) {
func TestPause_RunAtlas(t *testing.T) {
ctrl := gomock.NewController(t)
mockStore := mocks.NewMockClusterPauser(ctrl)
ctx := t.Context()
ctx := context.Background()

deploymentTest := fixture.NewMockAtlasDeploymentOpts(ctrl, deploymentName)

Expand Down
7 changes: 4 additions & 3 deletions internal/cli/deployments/search/indexes/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package indexes

import (
"bytes"
"context"
"errors"
"testing"

Expand Down Expand Up @@ -48,7 +49,7 @@ func TestCreate_RunLocal(t *testing.T) {
mockMongodbClient := mocks.NewMockMongoDBClient(ctrl)
mockDB := mocks.NewMockDatabase(ctrl)
mockColl := mocks.NewMockCollection(ctrl)
ctx := t.Context()
ctx := context.Background()

testDeployments := fixture.NewMockLocalDeploymentOpts(ctrl, expectedLocalDeployment)

Expand Down Expand Up @@ -171,7 +172,7 @@ func TestCreate_Duplicated(t *testing.T) {
mockMongodbClient := mocks.NewMockMongoDBClient(ctrl)
mockDB := mocks.NewMockDatabase(ctrl)
mockColl := mocks.NewMockCollection(ctrl)
ctx := t.Context()
ctx := context.Background()

testDeployments := fixture.NewMockLocalDeploymentOpts(ctrl, expectedLocalDeployment)

Expand Down Expand Up @@ -265,7 +266,7 @@ func TestCreate_Duplicated(t *testing.T) {
func TestCreate_RunAtlas(t *testing.T) {
ctrl := gomock.NewController(t)
mockIndexStore := mocks.NewMockSearchIndexCreatorDescriber(ctrl)
ctx := t.Context()
ctx := context.Background()
buf := new(bytes.Buffer)

deploymentTest := fixture.NewMockAtlasDeploymentOpts(ctrl, expectedLocalDeployment)
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/deployments/search/indexes/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package indexes

import (
"context"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -34,7 +35,7 @@ func TestDelete_RunLocal(t *testing.T) {
mockStore := mocks.NewMockSearchIndexDeleter(ctrl)
mockDB := mocks.NewMockDatabase(ctrl)
mockColl := mocks.NewMockCollection(ctrl)
ctx := t.Context()
ctx := context.Background()

expectedIndexName := "default"
const (
Expand Down Expand Up @@ -129,7 +130,7 @@ func TestDelete_RunAtlas(t *testing.T) {
ctrl := gomock.NewController(t)
mockMongodbClient := mocks.NewMockMongoDBClient(ctrl)
mockStore := mocks.NewMockSearchIndexDeleter(ctrl)
ctx := t.Context()
ctx := context.Background()

const (
expectedLocalDeployment = "localDeployment1"
Expand Down
5 changes: 3 additions & 2 deletions internal/cli/deployments/search/indexes/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package indexes

import (
"bytes"
"context"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -36,7 +37,7 @@ func TestDescribe_RunLocal(t *testing.T) {
ctrl := gomock.NewController(t)
mockMongodbClient := mocks.NewMockMongoDBClient(ctrl)
mockStore := mocks.NewMockSearchIndexDescriber(ctrl)
ctx := t.Context()
ctx := context.Background()

const (
expectedLocalDeployment = "localDeployment1"
Expand Down Expand Up @@ -123,7 +124,7 @@ func TestDescribe_RunAtlas(t *testing.T) {
ctrl := gomock.NewController(t)
mockMongodbClient := mocks.NewMockMongoDBClient(ctrl)
mockStore := mocks.NewMockSearchIndexDescriber(ctrl)
ctx := t.Context()
ctx := context.Background()

var (
expectedLocalDeployment = "localDeployment1"
Expand Down
Loading
Loading