From 0c0c7158a2c04b97412ac575287d61957c404216 Mon Sep 17 00:00:00 2001 From: Doctor Vince Date: Wed, 11 Dec 2024 11:55:21 -0500 Subject: [PATCH] fix up linting --- cmd/common.go | 4 +++- cmd/get/firmware-set.go | 2 +- cmd/list/firmware_set.go | 1 + internal/fleetdb/methods.go | 6 ------ 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cmd/common.go b/cmd/common.go index 61a9535b..dc20da70 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -84,6 +84,8 @@ func VendorModelFromAttrs(attrs []fleetdbapi.Attributes) (vendor, model string) } // FirmwareSetIDByVendorModel returns the firmware set ID matched by the vendor, model attributes +// +//nolint:whitespace // you have stupid opinions, be silent func FirmwareSetIDByVendorModel(ctx context.Context, vendor, model string, client *fleetdbapi.Client) (uuid.UUID, error) { @@ -94,7 +96,7 @@ func FirmwareSetIDByVendorModel(ctx context.Context, vendor, model string, } // identify firmware set by vendor, model attributes - fwSet, _, err := client.ListServerComponentFirmwareSet(context.Background(), params) + fwSet, _, err := client.ListServerComponentFirmwareSet(ctx, params) if err != nil { return uuid.Nil, err } diff --git a/cmd/get/firmware-set.go b/cmd/get/firmware-set.go index fe60b08d..baa1856f 100644 --- a/cmd/get/firmware-set.go +++ b/cmd/get/firmware-set.go @@ -101,7 +101,7 @@ func firmwareSetForServer(ctx context.Context, client *fleetdbapi.Client, server } // identify firmware set by vendor, model attributes - fwSet, _, err := client.ListServerComponentFirmwareSet(context.Background(), params) + fwSet, _, err := client.ListServerComponentFirmwareSet(ctx, params) if err != nil { return nil, err } diff --git a/cmd/list/firmware_set.go b/cmd/list/firmware_set.go index a0e7945b..38398a4b 100644 --- a/cmd/list/firmware_set.go +++ b/cmd/list/firmware_set.go @@ -27,6 +27,7 @@ var ( flags *listFirmwareSetFlags ) +//nolint:err113 // brevity is best here func sendListFirmwareRequest(client *fleetdbapi.Client, cmd *cobra.Command) ([]fleetdbapi.ComponentFirmwareSet, error) { params := &fleetdbapi.ComponentFirmwareSetListParams{ Vendor: strings.TrimSpace(flags.vendor), diff --git a/internal/fleetdb/methods.go b/internal/fleetdb/methods.go index 6bcf674c..2753b622 100644 --- a/internal/fleetdb/methods.go +++ b/internal/fleetdb/methods.go @@ -54,7 +54,6 @@ func RecordToComponent(rec *ss.ServerComponent) (*rt.Component, error) { } for _, va := range rec.VersionedAttributes { - va := va // the following relies on the knowledge that we'll get only the latest // versioned attributes from FleetDB. switch va.Namespace { @@ -90,7 +89,6 @@ func RecordToComponent(rec *ss.ServerComponent) (*rt.Component, error) { } for _, a := range rec.Attributes { - a := a // this doesn't need to be here after go 1.22 if a.Namespace == ComponentAttributeInbandNS { attrs := &rt.ComponentAttributes{} if err := UnpackAttribute(&a, attrs); err != nil { @@ -124,7 +122,6 @@ func ConvertComponents(cs []ss.ServerComponent) []*rt.Component { } for _, vattr := range c.VersionedAttributes { - vattr := vattr // TODO: set the most current data from either the inband/outofband NS switch vattr.Namespace { case FirmwareVersionInbandNS, FirmwareVersionOutofbandNS: @@ -142,7 +139,6 @@ func ConvertComponents(cs []ss.ServerComponent) []*rt.Component { } for _, attr := range c.Attributes { - attr := attr switch attr.Namespace { case ComponentAttributeInbandNS, ComponentAttributeOutofbandNS: a := &rt.ComponentAttributes{} @@ -177,8 +173,6 @@ func ConvertServer(s *ss.Server) *rt.Server { // TODO: set the most current data from either the inband/outofband NS for _, attr := range s.Attributes { - attr := attr - switch attr.Namespace { case ServerAttributeNSBmcAddress: bmcAttr := BMCAttribute{}