Skip to content

Commit ddcdfaa

Browse files
committed
fix: linting
Signed-off-by: Steve Freed <[email protected]>
1 parent d352625 commit ddcdfaa

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

receiver/redfishreceiver/config.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package redfishreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/redfishreceiver"
55

66
import (
7-
"fmt"
7+
"errors"
88
"time"
99

1010
"go.opentelemetry.io/collector/config/configopaque"
@@ -24,7 +24,7 @@ type Server struct {
2424
Insecure bool `mapstructure:"insecure"`
2525
Timeout string `mapstructure:"timeout"`
2626
Redfish redfishConfig `mapstructure:"redfish"`
27-
ComputerSystemId string `mapstructure:"computer_system_id"`
27+
ComputerSystemID string `mapstructure:"computer_system_id"`
2828
Resources []Resource `mapstructure:"resources"`
2929
}
3030

@@ -39,18 +39,18 @@ type Config struct {
3939

4040
func (cfg *Config) Validate() error {
4141
if len(cfg.Servers) == 0 {
42-
return fmt.Errorf("servers must not be empty")
42+
return errors.New("servers must not be empty")
4343
}
4444

45-
for _, server := range cfg.Servers {
46-
if server.Redfish.Version != "v1" {
47-
return fmt.Errorf("redfish version must be once of the following values: 'v1'")
45+
for i := range cfg.Servers {
46+
if cfg.Servers[i].Redfish.Version != "v1" {
47+
return errors.New("redfish version must be once of the following values: 'v1'")
4848
}
49-
if len(server.Resources) == 0 {
50-
return fmt.Errorf("resources must not be empty")
49+
if len(cfg.Servers[i].Resources) == 0 {
50+
return errors.New("resources must not be empty")
5151
}
52-
if _, err := time.ParseDuration(server.Timeout); err != nil && server.Timeout != "" {
53-
return fmt.Errorf("invalid server timeout")
52+
if _, err := time.ParseDuration(cfg.Servers[i].Timeout); err != nil && cfg.Servers[i].Timeout != "" {
53+
return errors.New("invalid server timeout")
5454
}
5555
}
5656
return nil

receiver/redfishreceiver/factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package redfishreceiver // import "github.com/open-telemetry/opentelemetry-colle
55

66
import (
77
"context"
8-
"fmt"
8+
"errors"
99
"time"
1010

1111
"go.opentelemetry.io/collector/component"
@@ -32,7 +32,7 @@ func createDefaultConfig() component.Config {
3232
func createMetricsReceiver(_ context.Context, params receiver.Settings, baseCfg component.Config, consumer consumer.Metrics) (receiver.Metrics, error) {
3333
cfg, ok := baseCfg.(*Config)
3434
if !ok {
35-
return nil, fmt.Errorf("invalid redfishreceiver config")
35+
return nil, errors.New("invalid redfishreceiver config")
3636
}
3737

3838
return scraperhelper.NewMetricsController(&cfg.ControllerConfig, params, consumer)

0 commit comments

Comments
 (0)