From 58bea9c89b9be43ebdf76de256d916a608df43c4 Mon Sep 17 00:00:00 2001 From: Oleksandr Slynko Date: Fri, 9 Oct 2020 15:56:22 +0100 Subject: [PATCH] Fix go vet issues (#720) * Fix go vet issues * to omit the property from JSON parsing one should use "-". "omit" in that case would use omit tag * The error was not reachable in the tests, so I moved it to the place where it make sense for me (but maybe it was just unnecessary) * Run all go vet linters in CI * This return breaks the test --- check/check.go | 9 ++++----- integration/integration.go | 2 -- makefile | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/check/check.go b/check/check.go index f000be0..aa44a00 100644 --- a/check/check.go +++ b/check/check.go @@ -67,8 +67,8 @@ type Check struct { Audit string `json:"audit"` AuditConfig string `yaml:"audit_config"` Type string `json:"type"` - Tests *tests `json:"omit"` - Set bool `json:"omit"` + Tests *tests `json:"-"` + Set bool `json:"-"` Remediation string `json:"remediation"` TestInfo []string `json:"test_info"` State `json:"status"` @@ -77,8 +77,8 @@ type Check struct { IsMultiple bool `yaml:"use_multiple_values"` ExpectedResult string `json:"expected_result"` Reason string `json:"reason,omitempty"` - AuditOutput string `json:"omit"` - AuditConfigOutput string `json:"omit"` + AuditOutput string `json:"-"` + AuditConfigOutput string `json:"-"` } // Runner wraps the basic Run method. @@ -101,7 +101,6 @@ func (r *defaultRunner) Run(c *Check) State { // Run executes the audit commands specified in a check and outputs // the results. func (c *Check) run() State { - // Since this is an Scored check // without tests return a 'WARN' to alert // the user that this check needs attention diff --git a/integration/integration.go b/integration/integration.go index 8dc306b..3dcee7a 100644 --- a/integration/integration.go +++ b/integration/integration.go @@ -121,8 +121,6 @@ func findPodForJob(clientset *kubernetes.Clientset, jobName string, duration tim } } } - - return nil, fmt.Errorf("no Pod found for Job %q", jobName) } func getPodLogs(clientset *kubernetes.Clientset, pod *apiv1.Pod) string { diff --git a/makefile b/makefile index ed60813..515ce6d 100644 --- a/makefile +++ b/makefile @@ -57,7 +57,7 @@ build-docker: # unit tests tests: - GO111MODULE=on go test -short -race -timeout 30s -coverprofile=coverage.txt -covermode=atomic ./... + GO111MODULE=on go test -vet all -short -race -timeout 30s -coverprofile=coverage.txt -covermode=atomic ./... # integration tests using kind integration-tests: build-docker