diff --git a/matchers/type_conversion.go b/matchers/type_conversion.go index 0d425bb4f..29fb96db8 100644 --- a/matchers/type_conversion.go +++ b/matchers/type_conversion.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "strconv" "strings" @@ -108,7 +107,7 @@ func (t ReaderToString) Transform(i interface{}) (interface{}, error) { return nil, fmt.Errorf("Expected io.reader, Got:%s", format.Object(i, 1)) } - b, err := ioutil.ReadAll(r) + b, err := io.ReadAll(r) if err != nil { return "", err } diff --git a/outputs/json.go b/outputs/json.go index 0d7063d0c..c2413aaf4 100644 --- a/outputs/json.go +++ b/outputs/json.go @@ -24,8 +24,7 @@ func (r Json) ValidOptions() []*formatOption { func (r Json) Output(w io.Writer, results <-chan []resource.TestResult, outConfig util.OutputConfig) (exitCode int) { - var pretty bool - pretty = util.IsValueInList(foPretty, outConfig.FormatOptions) + var pretty bool = util.IsValueInList(foPretty, outConfig.FormatOptions) includeRaw := !util.IsValueInList(foExcludeRaw, outConfig.FormatOptions) sort := util.IsValueInList(foSort, outConfig.FormatOptions) diff --git a/outputs/junit.go b/outputs/junit.go index 3e7de6ead..d50e3677e 100644 --- a/outputs/junit.go +++ b/outputs/junit.go @@ -34,8 +34,7 @@ func (r JUnit) Output(w io.Writer, results <-chan []resource.TestResult, // ISO8601 timeformat timestamp := time.Now().Format(time.RFC3339) - var summary map[int]string - summary = make(map[int]string) + var summary map[int]string = make(map[int]string) var startTime time.Time var endTime time.Time diff --git a/outputs/nagios.go b/outputs/nagios.go index d91776dba..2940d2235 100644 --- a/outputs/nagios.go +++ b/outputs/nagios.go @@ -31,8 +31,7 @@ func (r Nagios) Output(w io.Writer, results <-chan []resource.TestResult, var startTime time.Time var endTime time.Time - var summary map[int]string - summary = make(map[int]string) + var summary map[int]string = make(map[int]string) for resultGroup := range results { for _, testResult := range resultGroup { diff --git a/outputs/tap.go b/outputs/tap.go index 341e2a0ef..a5d6166ca 100644 --- a/outputs/tap.go +++ b/outputs/tap.go @@ -27,8 +27,7 @@ func (r Tap) Output(w io.Writer, results <-chan []resource.TestResult, testCount := 0 failed := 0 - var summary map[int]string - summary = make(map[int]string) + var summary map[int]string = make(map[int]string) for resultGroup := range results { for _, testResult := range resultGroup { diff --git a/system/file.go b/system/file.go index 86fa37f5b..65bf00d39 100644 --- a/system/file.go +++ b/system/file.go @@ -166,7 +166,7 @@ func realPath(path string) (string, error) { if f == "~" { usr, err = user.Current() } else { - usr, err = user.Lookup(f[1:len(f)]) + usr, err = user.Lookup(f[1:]) } if err != nil { return "", err diff --git a/util/config.go b/util/config.go index 8c0a68d19..e8e1239a7 100644 --- a/util/config.go +++ b/util/config.go @@ -271,7 +271,7 @@ func ValidateSections(unmarshal func(any) error, i any, whitelist map[string]boo typ := reflect.TypeOf(i) typs := strings.Split(typ.String(), ".")[1] for id, v := range toValidate { - for k, _ := range v { + for k := range v { if !whitelist[k] { return fmt.Errorf("invalid Attribute for %s:%s: %s", typs, id, k) }