diff --git a/cmd/outofband.go b/cmd/outofband.go index 4c4fc514c..f2b2e5049 100644 --- a/cmd/outofband.go +++ b/cmd/outofband.go @@ -192,11 +192,7 @@ func (c *outOfBandCmd) validateFlags() error { return err } - if err := c.validateFlagPublish(); err != nil { - return err - } - - return nil + return c.validateFlagPublish() } // validateFlagSource checks the -asset-source flag parameter values are as expected. diff --git a/cmd/version.go b/cmd/version.go index b47e855b8..e56581eb5 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -23,7 +23,7 @@ func newVersionCmd(rootCmd *rootCmd) *ffcli.Command { } } -func (c *versionCmd) Exec(ctx context.Context, _ []string) error { +func (c *versionCmd) Exec(_ context.Context, _ []string) error { fmt.Printf( "commit: %s\nbranch: %s\ngit summary: %s\nbuildDate: %s\nversion: %s\nGo version: %s\nironlib version: %s\nbmclib version: %s\nserverservice version: %s", version.GitCommit, version.GitBranch, version.GitSummary, version.BuildDate, version.AppVersion, version.GoVersion, version.IronlibVersion, version.BmclibVersion, version.ServerserviceVersion) diff --git a/internal/app/app.go b/internal/app/app.go index 6f14657a8..183a79748 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -38,7 +38,7 @@ type App struct { } // New returns a new alloy application object with the configuration loaded -func New(ctx context.Context, kind, cfgFile string, loglevel int) (app *App, err error) { +func New(_ context.Context, kind, cfgFile string, loglevel int) (app *App, err error) { switch kind { case model.AppKindInband, model.AppKindOutOfBand: default: diff --git a/internal/asset/csv.go b/internal/asset/csv.go index f3c7d0151..96f37f67c 100644 --- a/internal/asset/csv.go +++ b/internal/asset/csv.go @@ -33,7 +33,7 @@ type csvee struct { } // NewCSVGetter returns a new csv asset getter to retrieve asset information from a CSV file for inventory collection. -func NewCSVGetter(ctx context.Context, alloy *app.App, csvReader io.ReadCloser) (Getter, error) { +func NewCSVGetter(_ context.Context, alloy *app.App, csvReader io.ReadCloser) (Getter, error) { return &csvee{ logger: alloy.Logger.WithField("component", "getter-csv"), syncWg: alloy.SyncWg, @@ -44,11 +44,11 @@ func NewCSVGetter(ctx context.Context, alloy *app.App, csvReader io.ReadCloser) } // SetClient satisfies the Getter interface -func (c *csvee) SetClient(client interface{}) { +func (c *csvee) SetClient(_ interface{}) { } // AssetByID returns one asset from the inventory identified by its identifier. -func (c *csvee) AssetByID(ctx context.Context, assetID string, fetchBmcCredentials bool) (*model.Asset, error) { +func (c *csvee) AssetByID(ctx context.Context, assetID string, _ bool) (*model.Asset, error) { // attach child span ctx, span := tracer.Start(ctx, "AssetByID()") defer span.End() @@ -118,7 +118,7 @@ func sliceContains(sl []string, str string) bool { } // loadAssets returns a slice of assets from the given csv io.Reader -func (c *csvee) loadAssets(ctx context.Context, csvReader io.ReadCloser) ([]*model.Asset, error) { +func (c *csvee) loadAssets(_ context.Context, csvReader io.ReadCloser) ([]*model.Asset, error) { records, err := csv.NewReader(csvReader).ReadAll() if err != nil { return nil, err diff --git a/internal/collect/inband.go b/internal/collect/inband.go index a67111287..96852feb3 100644 --- a/internal/collect/inband.go +++ b/internal/collect/inband.go @@ -69,6 +69,6 @@ func (i *InbandCollector) InventoryLocal(ctx context.Context) (*model.Asset, err } // InventoryRemote implements is present here to satisfy the Collector interface. -func (i *InbandCollector) InventoryRemote(ctx context.Context) error { +func (i *InbandCollector) InventoryRemote(_ context.Context) error { return nil } diff --git a/internal/collect/outofband.go b/internal/collect/outofband.go index 28db98a34..1c1717ed4 100644 --- a/internal/collect/outofband.go +++ b/internal/collect/outofband.go @@ -110,7 +110,7 @@ func (o *OutOfBandCollector) SetMockGetter(getter interface{}) { } // InventoryLocal implements the Collector interface just to satisfy it. -func (o *OutOfBandCollector) InventoryLocal(ctx context.Context) (*model.Asset, error) { +func (o *OutOfBandCollector) InventoryLocal(_ context.Context) (*model.Asset, error) { return nil, nil } @@ -213,7 +213,7 @@ Loop: // based on the the number of tasks waiting in the worker queue. // // The asset getter pause flag is unset once the count of tasks waiting in the worker queue is below threshold levels. -func (o *OutOfBandCollector) taskQueueWait(span trace.Span) { +func (o *OutOfBandCollector) taskQueueWait(_ trace.Span) { // measure tasks waiting queue size metrics.TaskQueueSize.With(stageLabel).Set(float64(o.workers.WaitingQueueSize())) @@ -504,7 +504,7 @@ func (o *OutOfBandCollector) bmcLogout(bmc oobGetter, asset *model.Asset) { } // newBMCClient initializes a bmclib client with the given credentials -func newBMCClient(ctx context.Context, asset *model.Asset, l *logrus.Logger) *bmclibv2.Client { +func newBMCClient(_ context.Context, asset *model.Asset, l *logrus.Logger) *bmclibv2.Client { logger := logrus.New() logger.Formatter = l.Formatter diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go index 7a51e7c73..ad7a321b3 100644 --- a/internal/helpers/helpers.go +++ b/internal/helpers/helpers.go @@ -66,7 +66,7 @@ func NewServerServiceClient(ctx context.Context, cfg *model.Config, logger *logr } // returns a serverservice retryable client with Otel -func newServerserviceClientWithOtel(cfg *model.Config, endpoint string, logger *logrus.Entry) (*serverservice.Client, error) { +func newServerserviceClientWithOtel(_ *model.Config, endpoint string, logger *logrus.Entry) (*serverservice.Client, error) { // init retryable http client retryableClient := retryablehttp.NewClient() diff --git a/internal/publish/serverservice.go b/internal/publish/serverservice.go index b2eff7113..c43931a60 100644 --- a/internal/publish/serverservice.go +++ b/internal/publish/serverservice.go @@ -468,7 +468,7 @@ func (h *serverServicePublisher) createUpdateServerComponents(ctx context.Contex // diffFilter is a filter passed to the r3 diff filter method for comparing structs // // nolint:gocritic // r3diff requires the field attribute to be passed by value -func diffFilter(path []string, parent reflect.Type, field reflect.StructField) bool { +func diffFilter(_ []string, _ reflect.Type, field reflect.StructField) bool { switch field.Name { case "CreatedAt", "UpdatedAt", "LastReportedAt": return false diff --git a/internal/publish/stdout.go b/internal/publish/stdout.go index 862d23bf5..315889a31 100644 --- a/internal/publish/stdout.go +++ b/internal/publish/stdout.go @@ -25,7 +25,7 @@ type stdoutPublisher struct { } // NewStdoutPublisher returns a new publisher that prints received objects to stdout. -func NewStdoutPublisher(ctx context.Context, alloy *app.App) (Publisher, error) { +func NewStdoutPublisher(_ context.Context, alloy *app.App) (Publisher, error) { logger := app.NewLogrusEntryFromLogger(logrus.Fields{"component": "publisher-stdout"}, alloy.Logger) p := &stdoutPublisher{ @@ -42,7 +42,7 @@ func NewStdoutPublisher(ctx context.Context, alloy *app.App) (Publisher, error) // the method stops once the collector channel is closed. // // RunInventoryPublisher implements the Publisher interface -func (p *stdoutPublisher) RunInventoryPublisher(ctx context.Context) error { +func (p *stdoutPublisher) RunInventoryPublisher(_ context.Context) error { for device := range p.collectorCh { if device == nil { continue @@ -62,7 +62,7 @@ func (p *stdoutPublisher) RunInventoryPublisher(ctx context.Context) error { // PublishOne publishes the device parameter by printing the device object to stdout. // // PublishOne implements the Publisher interface -func (p *stdoutPublisher) PublishOne(ctx context.Context, device *model.Asset) error { +func (p *stdoutPublisher) PublishOne(_ context.Context, device *model.Asset) error { if device == nil { return nil }