Skip to content

Commit

Permalink
Fix linting for golang 1.15.8
Browse files Browse the repository at this point in the history
Signed-off-by: Sébastien Coavoux <sebastien.coavoux@azoplee.com>
  • Loading branch information
sebastien-coavoux committed Apr 21, 2021
1 parent e925eea commit 65b99c4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func ScrapeTarget(ctx context.Context, target string, config *config.Module, log
// evaluate rules
newGet := config.Get
newWalk := config.Walk
for _, filter := range config.Filters{
for _, filter := range config.Filters {
var pdus []gosnmp.SnmpPDU
allowedList := []string{}

Expand Down
18 changes: 9 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ type WalkParams struct {

type Module struct {
// A list of OIDs.
Walk []string `yaml:"walk,omitempty"`
Get []string `yaml:"get,omitempty"`
Metrics []*Metric `yaml:"metrics"`
WalkParams WalkParams `yaml:",inline"`
Filters []DynamicFilter `yaml:"filters,omitempty"`
Walk []string `yaml:"walk,omitempty"`
Get []string `yaml:"get,omitempty"`
Metrics []*Metric `yaml:"metrics"`
WalkParams WalkParams `yaml:",inline"`
Filters []DynamicFilter `yaml:"filters,omitempty"`
}

func (c *Module) UnmarshalYAML(unmarshal func(interface{}) error) error {
Expand Down Expand Up @@ -183,18 +183,18 @@ func (c WalkParams) ConfigureSNMP(g *gosnmp.GoSNMP) {
}

type Filters struct {
Static []StaticFilter `yaml:"static,omitempty"`
Static []StaticFilter `yaml:"static,omitempty"`
Dynamic []DynamicFilter `yaml:"dynamic,omitempty"`
}

type StaticFilter struct {
Targets []string `yaml:"targets,omitempty"`
Targets []string `yaml:"targets,omitempty"`
Instances []string `yaml:"instances,omitempty"`
}
type DynamicFilter struct {
Oid string `yaml:"oid"`
Oid string `yaml:"oid"`
Targets []string `yaml:"targets,omitempty"`
Values []string `yaml:"values,omitempty"`
Values []string `yaml:"values,omitempty"`
}

type Metric struct {
Expand Down
2 changes: 1 addition & 1 deletion generator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type ModuleConfig struct {
Lookups []*Lookup `yaml:"lookups"`
WalkParams config.WalkParams `yaml:",inline"`
Overrides map[string]MetricOverrides `yaml:"overrides"`
Filters config.Filters `yaml:"filters,omitempty"`
Filters config.Filters `yaml:"filters,omitempty"`
}

type Lookup struct {
Expand Down
2 changes: 1 addition & 1 deletion generator/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func generateConfigModule(cfg *ModuleConfig, node *Node, nameToNode map[string]*
// Build an map of all oid targeted by a filter to access it easily later
filterMap := map[string][]string{}

for _, filter := range cfg.Filters.Static{
for _, filter := range cfg.Filters.Static {
for _, oid := range filter.Targets {
n, ok := nameToNode[oid]
if ok {
Expand Down

0 comments on commit 65b99c4

Please sign in to comment.