From ff32f9e353078fbd4107aa0521d8cc0446a6f18c Mon Sep 17 00:00:00 2001 From: Gustavo Caso Date: Fri, 5 Jan 2024 15:29:47 +0100 Subject: [PATCH] apply feedback --- comp/core/status/render_helpers.go | 3 +-- pkg/cli/subcommands/check/command.go | 3 +-- pkg/status/collector/collector.go | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/comp/core/status/render_helpers.go b/comp/core/status/render_helpers.go index 99f063a8f89c18..236962378ba373 100644 --- a/comp/core/status/render_helpers.go +++ b/comp/core/status/render_helpers.go @@ -129,7 +129,6 @@ func lastErrorMessage(value string) string { // formatUnixTime formats the unix time to make it more readable func formatUnixTime(unixTime any) string { // Initially treat given unixTime is in nanoseconds - parseFunction := func(value int64) string { t := time.Unix(0, value) // If year returned 1970, assume unixTime actually in seconds @@ -154,7 +153,7 @@ func formatUnixTime(unixTime any) string { case float64: return parseFunction(int64(v)) default: - return "" + return fmt.Sprintf("Invalid time parameter %T", v) } } diff --git a/pkg/cli/subcommands/check/command.go b/pkg/cli/subcommands/check/command.go index fbf9a28a0f9077..0983e5e433c720 100644 --- a/pkg/cli/subcommands/check/command.go +++ b/pkg/cli/subcommands/check/command.go @@ -450,19 +450,18 @@ func run( checkRuns := collectorData["runnerStats"].(map[string]interface{})["Checks"].(map[string]interface{}) for _, c := range cs { s := runCheck(cliParams, c, printer) - var checkResult map[string]interface{} resultBytes, err := json.Marshal(s) if err != nil { return err } + var checkResult map[string]interface{} err = json.Unmarshal(resultBytes, &checkResult) if err != nil { return err } checkMap := make(map[string]interface{}) - checkMap[string(c.ID())] = checkResult checkRuns[c.String()] = checkMap diff --git a/pkg/status/collector/collector.go b/pkg/status/collector/collector.go index f0707768923625..cf2935aa337859 100644 --- a/pkg/status/collector/collector.go +++ b/pkg/status/collector/collector.go @@ -93,7 +93,7 @@ func PopulateStatus(stats map[string]interface{}) { stats["inventories"] = checkMetadata } -// Provider provides the functionality to populate the status output with the collectro information +// Provider provides the functionality to populate the status output with the collector information type Provider struct{} // Name returns the name