mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 14:09:21 +00:00
Merge pull request #36 from cmertz/remove-gosimple-warnings
remove gosimple offences
This commit is contained in:
commit
171d894752
7 changed files with 7 additions and 7 deletions
|
|
@ -29,7 +29,7 @@ func processResults(cancel context.CancelFunc, o output.Output, validationResult
|
|||
fmt.Fprint(os.Stderr, "failed writing log\n")
|
||||
}
|
||||
}
|
||||
if success == false && exitOnError {
|
||||
if !success && exitOnError {
|
||||
cancel() // early exit - signal to stop searching for resources
|
||||
break
|
||||
}
|
||||
|
|
|
|||
2
pkg/cache/inmemory.go
vendored
2
pkg/cache/inmemory.go
vendored
|
|
@ -31,7 +31,7 @@ func (c *inMemory) Get(resourceKind, resourceAPIVersion, k8sVersion string) (int
|
|||
defer c.RUnlock()
|
||||
schema, ok := c.schemas[k]
|
||||
|
||||
if ok == false {
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("schema not found in in-memory cache")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ func TestDownloadSchema(t *testing.T) {
|
|||
t.Errorf("during test '%s': expected error, got:\n%s\n%s\n", testCase.name, testCase.expectErr, err)
|
||||
}
|
||||
|
||||
if bytes.Compare(res, testCase.expect) != 0 {
|
||||
if !bytes.Equal(res, testCase.expect) {
|
||||
t.Errorf("during test '%s': expected %s, got %s", testCase.name, testCase.expect, res)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ func findResourcesInReader(p string, f io.Reader, resources chan<- Resource, err
|
|||
scanner.Buffer(buf, len(buf))
|
||||
scanner.Split(SplitYAMLDocument)
|
||||
nRes := 0
|
||||
for res := scanner.Scan(); res != false; res = scanner.Scan() {
|
||||
for scanner.Scan() {
|
||||
if len(scanner.Text()) > 0 {
|
||||
resources <- Resource{Path: p, Bytes: []byte(scanner.Text())}
|
||||
nRes++
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func FromStream(ctx context.Context, path string, r io.Reader) (<-chan Resource,
|
|||
scanner.Split(SplitYAMLDocument)
|
||||
|
||||
SCAN:
|
||||
for res := scanner.Scan(); res != false; res = scanner.Scan() {
|
||||
for scanner.Scan() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
break SCAN
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ kind: Deployment
|
|||
t.Errorf("test %d - expected %d resources, got %d", testi, len(testCase.Want.Resources), len(res))
|
||||
}
|
||||
for i, v := range res {
|
||||
if bytes.Compare(v.Bytes, testCase.Want.Resources[i].Bytes) != 0 {
|
||||
if !bytes.Equal(v.Bytes, testCase.Want.Resources[i].Bytes) {
|
||||
t.Errorf("test %d - for resource %d, got '%s', expected '%s'", testi, i, string(res[i].Bytes), string(testCase.Want.Resources[i].Bytes))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ type Opts struct {
|
|||
func New(schemaLocations []string, opts Opts) (Validator, error) {
|
||||
// Default to our kubernetes-json-schema fork
|
||||
// raw.githubusercontent.com is frontend by Fastly and very fast
|
||||
if schemaLocations == nil || len(schemaLocations) == 0 {
|
||||
if len(schemaLocations) == 0 {
|
||||
schemaLocations = []string{"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json"}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue