Skip to content

Commit

Permalink
fix linter findings for windows and darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
zak-pawel committed Oct 19, 2024
1 parent a29b331 commit 3b8302c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
8 changes: 0 additions & 8 deletions plugins/inputs/ethtool/ethtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ var sampleConfig string

const pluginName = "ethtool"

type command interface {
init() error
driverName(intf namespacedInterface) (string, error)
interfaces(includeNamespaces bool) ([]namespacedInterface, error)
stats(intf namespacedInterface) (map[string]uint64, error)
get(intf namespacedInterface) (map[string]uint64, error)
}

func (*Ethtool) SampleConfig() string {
return sampleConfig
}
8 changes: 8 additions & 0 deletions plugins/inputs/ethtool/ethtool_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ type Ethtool struct {
command command
}

type command interface {
init() error
driverName(intf namespacedInterface) (string, error)
interfaces(includeNamespaces bool) ([]namespacedInterface, error)
stats(intf namespacedInterface) (map[string]uint64, error)
get(intf namespacedInterface) (map[string]uint64, error)
}

type commandEthtool struct {
log telegraf.Logger
namespaceGoroutines map[string]*namespaceGoroutine
Expand Down
16 changes: 0 additions & 16 deletions plugins/inputs/ethtool/namespace.go

This file was deleted.

15 changes: 15 additions & 0 deletions plugins/inputs/ethtool/namespace_linux.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build linux

package ethtool

import (
Expand All @@ -11,6 +13,19 @@ import (
"github.com/influxdata/telegraf"
)

type namespace interface {
name() string
interfaces() ([]namespacedInterface, error)
driverName(intf namespacedInterface) (string, error)
stats(intf namespacedInterface) (map[string]uint64, error)
get(intf namespacedInterface) (map[string]uint64, error)
}

type namespacedInterface struct {
net.Interface
namespace namespace
}

type namespacedAction struct {
result chan<- namespacedResult
f func(*namespaceGoroutine) (interface{}, error)
Expand Down

0 comments on commit 3b8302c

Please sign in to comment.