Skip to content

Commit

Permalink
make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
joelrebel committed Aug 31, 2023
1 parent e246231 commit b2b010b
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 20 deletions.
6 changes: 1 addition & 5 deletions cmd/outofband.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions internal/asset/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/collect/inband.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions internal/collect/outofband.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion internal/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion internal/publish/serverservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions internal/publish/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit b2b010b

Please sign in to comment.