From 566d24ea249420f66e3e20de320b424e38972b7c Mon Sep 17 00:00:00 2001 From: Dudi Dolev Date: Mon, 20 Jan 2025 16:45:46 +0200 Subject: [PATCH] WIP - fix lint --- exporter/currentop_collector.go | 2 +- exporter/diagnostic_data_collector.go | 1 + exporter/feature_compatibility_version_collector.go | 2 +- exporter/replset_status_collector.go | 2 +- exporter/topology_info.go | 2 +- exporter/v1_compatibility.go | 8 ++++---- internal/util/util.go | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/exporter/currentop_collector.go b/exporter/currentop_collector.go index 79f4b246..2a2b0333 100644 --- a/exporter/currentop_collector.go +++ b/exporter/currentop_collector.go @@ -17,9 +17,9 @@ package exporter import ( "context" + "os" "strconv" "time" - "os" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" diff --git a/exporter/diagnostic_data_collector.go b/exporter/diagnostic_data_collector.go index c6c5a9f0..750eff78 100644 --- a/exporter/diagnostic_data_collector.go +++ b/exporter/diagnostic_data_collector.go @@ -18,6 +18,7 @@ package exporter import ( "context" "os" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/exporter/feature_compatibility_version_collector.go b/exporter/feature_compatibility_version_collector.go index 1b4104cb..45550f71 100644 --- a/exporter/feature_compatibility_version_collector.go +++ b/exporter/feature_compatibility_version_collector.go @@ -18,8 +18,8 @@ package exporter import ( "context" "fmt" - "strconv" "os" + "strconv" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/exporter/replset_status_collector.go b/exporter/replset_status_collector.go index be305007..988133ce 100644 --- a/exporter/replset_status_collector.go +++ b/exporter/replset_status_collector.go @@ -28,7 +28,7 @@ import ( const ( replicationNotEnabled = 76 replicationNotYetInitialized = 94 - Unauthorized = 13 + Unauthorized = 13 ) type replSetGetStatusCollector struct { diff --git a/exporter/topology_info.go b/exporter/topology_info.go index a7686477..e18c3fe0 100644 --- a/exporter/topology_info.go +++ b/exporter/topology_info.go @@ -18,8 +18,8 @@ package exporter import ( "context" "fmt" - "sync" "os" + "sync" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/exporter/v1_compatibility.go b/exporter/v1_compatibility.go index 27a53c2e..202a5aaf 100644 --- a/exporter/v1_compatibility.go +++ b/exporter/v1_compatibility.go @@ -19,9 +19,9 @@ import ( "context" "fmt" "math" + "os" "strings" "time" - "os" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -838,7 +838,7 @@ func retrieveMongoDBBuildInfo(ctx context.Context, client *mongo.Client, l *logr if err != nil { if e, ok := err.(mongo.CommandError); ok { if e.Code == Unauthorized { - errors.Wrap(err,"unauthorized to run command buildInfo") + errors.Wrap(err, "unauthorized to run command buildInfo") os.Exit(1) } } @@ -1185,7 +1185,7 @@ func chunksBalancerRunning(ctx context.Context, client *mongo.Client) (prometheu if err := res.Decode(&m); err != nil { if e, ok := err.(mongo.CommandError); ok { if e.Code == Unauthorized { - errors.Wrap(err,"unauthorized to run command balancerStatus") + errors.Wrap(err, "unauthorized to run command balancerStatus") os.Exit(1) } } @@ -1216,7 +1216,7 @@ func balancerEnabled(ctx context.Context, client *mongo.Client) (prometheus.Metr if err != nil { if e, ok := err.(mongo.CommandError); ok { if e.Code == Unauthorized { - errors.Wrap(err,"unauthorized to run command balancerStatus") + errors.Wrap(err, "unauthorized to run command balancerStatus") os.Exit(1) } } diff --git a/internal/util/util.go b/internal/util/util.go index 7284b924..cecb4f65 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -31,7 +31,7 @@ const ( ErrNotYetInitialized = int32(94) ErrNoReplicationEnabled = int32(76) ErrNotPrimaryOrSecondary = int32(13436) - ErrNotUnauthorized = int32(13) + ErrNotUnauthorized = int32(13) ) // MyState returns the replica set and the instance's state if available.