1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2024-11-26 01:49:28 +00:00

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
This commit is contained in:
Oleksandr Slynko 2020-10-09 15:56:22 +01:00 committed by GitHub
parent f213918552
commit 58bea9c89b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 8 deletions

View File

@ -67,8 +67,8 @@ type Check struct {
Audit string `json:"audit"` Audit string `json:"audit"`
AuditConfig string `yaml:"audit_config"` AuditConfig string `yaml:"audit_config"`
Type string `json:"type"` Type string `json:"type"`
Tests *tests `json:"omit"` Tests *tests `json:"-"`
Set bool `json:"omit"` Set bool `json:"-"`
Remediation string `json:"remediation"` Remediation string `json:"remediation"`
TestInfo []string `json:"test_info"` TestInfo []string `json:"test_info"`
State `json:"status"` State `json:"status"`
@ -77,8 +77,8 @@ type Check struct {
IsMultiple bool `yaml:"use_multiple_values"` IsMultiple bool `yaml:"use_multiple_values"`
ExpectedResult string `json:"expected_result"` ExpectedResult string `json:"expected_result"`
Reason string `json:"reason,omitempty"` Reason string `json:"reason,omitempty"`
AuditOutput string `json:"omit"` AuditOutput string `json:"-"`
AuditConfigOutput string `json:"omit"` AuditConfigOutput string `json:"-"`
} }
// Runner wraps the basic Run method. // 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 // Run executes the audit commands specified in a check and outputs
// the results. // the results.
func (c *Check) run() State { func (c *Check) run() State {
// Since this is an Scored check // Since this is an Scored check
// without tests return a 'WARN' to alert // without tests return a 'WARN' to alert
// the user that this check needs attention // the user that this check needs attention

View File

@ -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 { func getPodLogs(clientset *kubernetes.Clientset, pod *apiv1.Pod) string {

View File

@ -57,7 +57,7 @@ build-docker:
# unit tests # unit tests
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 using kind
integration-tests: build-docker integration-tests: build-docker