Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (c *Config) addDefaultFlags() {
// type Config struct {
// Token string `env:"BEARER_TOKEN"`
// }
func LoadFromEnv(config interface{}) {
func LoadFromEnv(config any) {
configValue := reflect.ValueOf(config).Elem()
configType := configValue.Type()

Expand Down
2 changes: 1 addition & 1 deletion exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var PrintStack = true
// Output is the formatting string, and the rest of the arguments help adding values.
//
// Also see fmt package: https://golang.org/pkg/fmt
func Exitf(rc int, output string, args ...interface{}) {
func Exitf(rc int, output string, args ...any) {
ExitRaw(rc, fmt.Sprintf(output, args...))
}

Expand Down
10 changes: 5 additions & 5 deletions perfdata/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var replacer = strings.NewReplacer("=", "_", "`", "_", "'", "_", "\"", "_")
// represent a valid measurement, e.g INF for floats
// This error can probably ignored in most cases and the perfdata point omitted,
// but silently dropping the value and returning the empty strings seems like bad style
func formatNumeric(value interface{}) (string, error) {
func formatNumeric(value any) (string, error) {
switch v := value.(type) {
case float64:
if math.IsInf(v, 0) {
Expand Down Expand Up @@ -61,13 +61,13 @@ func formatNumeric(value interface{}) (string, error) {
// https://icinga.com/docs/icinga-2/latest/doc/05-service-monitoring/#unit-of-measurement-uom
type Perfdata struct {
Label string
Value interface{}
Value any
// Uom is the unit-of-measurement, see links above for details.
Uom string
Warn *check.Threshold
Crit *check.Threshold
Min interface{}
Max interface{}
Min any
Max any
}

// String returns the proper format for the plugin output
Expand Down Expand Up @@ -109,7 +109,7 @@ func (p Perfdata) ValidatedString() (string, error) {
}

// Limits
for _, value := range []interface{}{p.Min, p.Max} {
for _, value := range []any{p.Min, p.Max} {
sb.WriteString(";")

if value != nil {
Expand Down
2 changes: 1 addition & 1 deletion result/worst_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func BenchmarkWorstState(b *testing.B) {

// Initialize slice for benchmarking
states := make([]int, 0, 100)
for i := 0; i < 100; i++ {
for i := range 100 {
states = append(states, i%4)
}

Expand Down
Loading