Skip to content

Commit

Permalink
CLOUDP-271289: updated golangci-lint to 1.60.3 and fixed new lintintg…
Browse files Browse the repository at this point in the history
… errors (#3233)
  • Loading branch information
jeroenvervaeke authored Sep 3, 2024
1 parent d26c79e commit dd5a02d
Show file tree
Hide file tree
Showing 22 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.59.1
version: v1.60.3
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 @@ -109,7 +109,7 @@ linters:
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false, auto-fix: false]
- errorlint # Errorlint is a linter that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13.
- exhaustive # check exhaustiveness of enum switch statements [fast: false, auto-fix: false]
- exportloopref # checks for pointers to enclosing loop variables [fast: false, auto-fix: false]
- copyloopvar # copyloopvar is a linter detects places where loop variables are copied. Replaces exportloopref since Go1.22
- gci # Gci controls golang package import order and makes it always deterministic. [fast: true, auto-fix: false]
- gochecknoinits # Checks that no init functions are present in Go code [fast: true, auto-fix: false]
- goconst # Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
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.59.1
GOLANGCI_VERSION=v1.60.3
COVERAGE=coverage.out

MCLI_GIT_SHA?=$(shell git rev-parse HEAD)
Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-clusters-create.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Options
- false
- Flag that indicates whether to watch the command until it completes its execution or the watch times out. To set the time that the watch times out, use the --watchTimeout option.
* - --watchTimeout
- uint
- int
- false
- Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.

Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-clusters-delete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Options
- false
- Flag that indicates whether to watch the command until it completes its execution or the watch times out. To set the time that the watch times out, use the --watchTimeout option.
* - --watchTimeout
- uint
- int
- false
- Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.

Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-clusters-search-nodes-create.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Options
- false
- Flag that indicates whether to watch the command until it completes its execution or the watch times out.
* - --watchTimeout
- uint
- int
- false
- Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.

Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-clusters-search-nodes-delete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Options
- false
- Flag that indicates whether to watch the command until it completes its execution or the watch times out.
* - --watchTimeout
- uint
- int
- false
- Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.

Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-clusters-search-nodes-update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Options
- false
- Flag that indicates whether to watch the command until it completes its execution or the watch times out.
* - --watchTimeout
- uint
- int
- false
- Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.

Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-deployments-delete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Options
- false
- Flag that indicates whether to watch the command until it completes its execution or the watch times out. To set the time that the watch times out, use the --watchTimeout option.
* - --watchTimeout
- uint
- int
- false
- Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.

Expand Down
2 changes: 1 addition & 1 deletion docs/command/atlas-deployments-search-indexes-create.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Options
- false
- Flag that indicates whether to watch the command until it completes its execution or the watch times out. To set the time that the watch times out, use the --watchTimeout option.
* - --watchTimeout
- uint
- int
- false
- Time in seconds until a watch times out. After a watch times out, the CLI no longer watches the command.

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/clusters/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ For full control of your deployment, or to create multi-cloud clusters, provide
cmd.Flags().StringToStringVar(&opts.tag, flag.Tag, nil, usage.Tag)

cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatch)
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().Int64Var(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
cmd.Flags().StringVarP(&opts.Output, flag.Output, flag.OutputShort, "", usage.FormatOut)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/clusters/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Deleting a cluster also deletes any backup snapshots for that cluster.
cmd.Flags().BoolVar(&opts.Confirm, flag.Force, false, usage.Force)

cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatch)
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().Int64Var(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/deployments/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Deleting a Local deployment also deletes any local data volumes.
cmd.Flags().StringVar(&opts.DeploymentType, flag.TypeFlag, "", usage.DeploymentType)
cmd.Flags().BoolVar(&opts.Confirm, flag.Force, false, usage.Force)
cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatch)
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().Int64Var(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)

cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)

Expand Down
2 changes: 1 addition & 1 deletion internal/cli/deployments/search/indexes/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func CreateBuilder() *cobra.Command {

// Local only
cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatch)
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().Int64Var(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().StringVar(&opts.DeploymentOpts.DBUsername, flag.Username, "", usage.DBUsername)
cmd.Flags().StringVar(&opts.DeploymentOpts.DBUserPassword, flag.Password, "", usage.Password)

Expand Down
1 change: 1 addition & 0 deletions internal/cli/plugin/plugin_github_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func extractTarGz(src string, dest string) error {

switch header.Typeflag {
case tar.TypeDir:
//nolint:gosec
if err := os.MkdirAll(filePath, os.FileMode(header.Mode)); err != nil {
return errCreateExtractionDir
}
Expand Down
1 change: 0 additions & 1 deletion internal/cli/root/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ func TestOutputOpts_notifyIfApplicable(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(fmt.Sprintf("%v/%v", tt.currentVersion, tt.release), func(t *testing.T) {
prevVersion := version.Version
version.Version = tt.currentVersion
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/search/nodes/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func CreateBuilder() *cobra.Command {
_ = cmd.MarkFlagRequired(flag.File)

cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatchDefault)
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().Int64Var(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)

// Global flags
cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/search/nodes/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func DeleteBuilder() *cobra.Command {
_ = cmd.MarkFlagRequired(flag.ClusterName)

cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatchDefault)
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().Int64Var(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().BoolVar(&opts.Confirm, flag.Force, false, usage.Force)

// Global flags
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/search/nodes/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func UpdateBuilder() *cobra.Command {
_ = cmd.MarkFlagRequired(flag.File)

cmd.Flags().BoolVarP(&opts.EnableWatch, flag.EnableWatch, flag.EnableWatchShort, false, usage.EnableWatchDefault)
cmd.Flags().UintVar(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)
cmd.Flags().Int64Var(&opts.Timeout, flag.WatchTimeout, 0, usage.WatchTimeout)

// Global flags
cmd.Flags().StringVar(&opts.ProjectID, flag.ProjectID, "", usage.ProjectID)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/watch_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type WatchOpts struct {
s *spinner.Spinner
EnableWatch bool
DefaultWait time.Duration
Timeout uint
Timeout int64
IsRetryableErr func(err error) bool
}

Expand Down
2 changes: 0 additions & 2 deletions internal/config/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ func TestProfile_Rename(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
p := &Profile{
Expand Down Expand Up @@ -259,7 +258,6 @@ func TestProfile_SetName(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
p := &Profile{
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ func AtlasCLIBin() (string, error) {
return cliPath, nil
}

func RandInt(max int64) (*big.Int, error) {
return rand.Int(rand.Reader, big.NewInt(max))
func RandInt(maximum int64) (*big.Int, error) {
return rand.Int(rand.Reader, big.NewInt(maximum))
}

0 comments on commit dd5a02d

Please sign in to comment.