From befda1e550403986e3d7b1d65241a5117200c7a2 Mon Sep 17 00:00:00 2001 From: Jake Schuurmans Date: Mon, 25 Sep 2023 11:11:48 -0400 Subject: [PATCH] linting --- internal/app/app.go | 6 +++--- internal/config/config.go | 8 ++++---- internal/inventory/serverservice.go | 6 +++--- internal/vendors/asrockrack/asrockrack.go | 4 ++-- internal/vendors/dell/dell.go | 2 +- internal/vendors/equinix/equinix.go | 2 +- internal/vendors/intel/intel.go | 2 +- internal/vendors/mellanox/mellanox.go | 2 +- internal/vendors/supermicro/supermicro.go | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/internal/app/app.go b/internal/app/app.go index 2699cced..0375ee1a 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -5,8 +5,6 @@ import ( "os" "github.com/bmc-toolbox/common" - "github.com/sirupsen/logrus" - "github.com/spf13/viper" "github.com/metal-toolbox/firmware-syncer/internal/config" "github.com/metal-toolbox/firmware-syncer/internal/vendors" "github.com/metal-toolbox/firmware-syncer/internal/vendors/asrockrack" @@ -15,6 +13,8 @@ import ( "github.com/metal-toolbox/firmware-syncer/internal/vendors/intel" "github.com/metal-toolbox/firmware-syncer/internal/vendors/mellanox" "github.com/metal-toolbox/firmware-syncer/internal/vendors/supermicro" + "github.com/sirupsen/logrus" + "github.com/spf13/viper" ) var ( @@ -51,9 +51,9 @@ func New(configFile string, logLevel int) (*Syncer, error) { v.SetConfigFile("config.yaml") v.AddConfigPath(".") err := v.ReadInConfig() + if err != nil { logger.Error("Failed to find viper config file") - // return nil, err } // Load configuration diff --git a/internal/config/config.go b/internal/config/config.go index db4991b7..ea811b03 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -11,9 +11,9 @@ import ( "strings" "time" - "gopkg.in/yaml.v2" - "github.com/spf13/viper" "github.com/sirupsen/logrus" + "github.com/spf13/viper" + "gopkg.in/yaml.v2" serverservice "go.hollow.sh/serverservice/pkg/api/v1" ) @@ -149,11 +149,11 @@ func ParseRepositoryURL(repositoryURL string) (endpoint, bucket string, err erro return u.Host, bucket, nil } -func LoadEnvironmentVariable(v* viper.Viper, logger *logrus.Logger, key string) (string) { +func LoadEnvironmentVariable(v *viper.Viper, logger *logrus.Logger, key string) string { val := v.Get(key) if val == nil { logger.Warnf("Failed to find %s in config.yaml", key) } return val.(string) -} \ No newline at end of file +} diff --git a/internal/inventory/serverservice.go b/internal/inventory/serverservice.go index f2d63791..36f91895 100644 --- a/internal/inventory/serverservice.go +++ b/internal/inventory/serverservice.go @@ -10,10 +10,10 @@ import ( "github.com/metal-toolbox/firmware-syncer/internal/config" "github.com/pkg/errors" "github.com/sirupsen/logrus" - "golang.org/x/exp/slices" - "golang.org/x/oauth2/clientcredentials" "github.com/spf13/viper" serverservice "go.hollow.sh/serverservice/pkg/api/v1" + "golang.org/x/exp/slices" + "golang.org/x/oauth2/clientcredentials" ) var ( @@ -27,7 +27,7 @@ type ServerService struct { logger *logrus.Logger } -func New(ctx context.Context, serverServiceURL, artifactsURL string, logger *logrus.Logger, v* viper.Viper) (*ServerService, error) { +func New(ctx context.Context, serverServiceURL, artifactsURL string, logger *logrus.Logger, v *viper.Viper) (*ServerService, error) { if artifactsURL == "" { return nil, errors.New("missing artifacts URL") } diff --git a/internal/vendors/asrockrack/asrockrack.go b/internal/vendors/asrockrack/asrockrack.go index a501f7a5..1dc88263 100644 --- a/internal/vendors/asrockrack/asrockrack.go +++ b/internal/vendors/asrockrack/asrockrack.go @@ -6,11 +6,11 @@ import ( "github.com/metal-toolbox/firmware-syncer/internal/config" "github.com/metal-toolbox/firmware-syncer/internal/inventory" "github.com/metal-toolbox/firmware-syncer/internal/vendors" - "github.com/spf13/viper" "github.com/pkg/errors" rcloneFs "github.com/rclone/rclone/fs" rcloneOperations "github.com/rclone/rclone/fs/operations" "github.com/sirupsen/logrus" + "github.com/spf13/viper" serverservice "go.hollow.sh/serverservice/pkg/api/v1" ) @@ -27,7 +27,7 @@ type ASRockRack struct { tmpFs rcloneFs.Fs } -func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v* viper.Viper) (vendors.Vendor, error) { +func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v *viper.Viper) (vendors.Vendor, error) { // RepositoryURL required if cfgSyncer.RepositoryURL == "" { return nil, errors.Wrap(config.ErrProviderAttributes, "RepositoryURL not defined") diff --git a/internal/vendors/dell/dell.go b/internal/vendors/dell/dell.go index 2fdd94db..68b4fcd6 100644 --- a/internal/vendors/dell/dell.go +++ b/internal/vendors/dell/dell.go @@ -29,7 +29,7 @@ type DUP struct { } // NewDUP returns a new DUP firmware syncer object -func NewDUP(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v* viper.Viper) (vendors.Vendor, error) { +func NewDUP(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v *viper.Viper) (vendors.Vendor, error) { // RepositoryURL required if cfgSyncer.RepositoryURL == "" { return nil, errors.Wrap(config.ErrProviderAttributes, "RepositoryURL not defined") diff --git a/internal/vendors/equinix/equinix.go b/internal/vendors/equinix/equinix.go index bdd66ea5..8c167f76 100644 --- a/internal/vendors/equinix/equinix.go +++ b/internal/vendors/equinix/equinix.go @@ -36,7 +36,7 @@ type Equinix struct { tmpFs fs.Fs } -func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v* viper.Viper) (vendors.Vendor, error) { +func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v *viper.Viper) (vendors.Vendor, error) { // RepositoryURL required if cfgSyncer.RepositoryURL == "" { return nil, errors.Wrap(config.ErrProviderAttributes, "RepositoryURL not defined") diff --git a/internal/vendors/intel/intel.go b/internal/vendors/intel/intel.go index e709840d..e9c3f79e 100644 --- a/internal/vendors/intel/intel.go +++ b/internal/vendors/intel/intel.go @@ -27,7 +27,7 @@ type Intel struct { tmpFs fs.Fs } -func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v* viper.Viper) (vendors.Vendor, error) { +func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v *viper.Viper) (vendors.Vendor, error) { // RepositoryURL required if cfgSyncer.RepositoryURL == "" { return nil, errors.Wrap(config.ErrProviderAttributes, "RepositoryURL not defined") diff --git a/internal/vendors/mellanox/mellanox.go b/internal/vendors/mellanox/mellanox.go index b68bd62d..1d92baa1 100644 --- a/internal/vendors/mellanox/mellanox.go +++ b/internal/vendors/mellanox/mellanox.go @@ -28,7 +28,7 @@ type Mellanox struct { inventory *inventory.ServerService } -func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v* viper.Viper) (vendors.Vendor, error) { +func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v *viper.Viper) (vendors.Vendor, error) { // RepositoryURL required if cfgSyncer.RepositoryURL == "" { return nil, errors.Wrap(config.ErrProviderAttributes, "RepositoryURL not defined") diff --git a/internal/vendors/supermicro/supermicro.go b/internal/vendors/supermicro/supermicro.go index f3ac3026..f9026a6d 100644 --- a/internal/vendors/supermicro/supermicro.go +++ b/internal/vendors/supermicro/supermicro.go @@ -33,7 +33,7 @@ type Supermicro struct { tmpFs fs.Fs } -func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v* viper.Viper) (vendors.Vendor, error) { +func New(ctx context.Context, firmwares []*serverservice.ComponentFirmwareVersion, cfgSyncer *config.Syncer, logger *logrus.Logger, v *viper.Viper) (vendors.Vendor, error) { // RepositoryURL required if cfgSyncer.RepositoryURL == "" { return nil, errors.Wrap(config.ErrProviderAttributes, "RepositoryURL not defined")