Enable more linters for new code

This commit is contained in:
Katrina Verey
2022-03-30 17:34:38 -04:00
parent 71bf0d5d14
commit b0d2e4bdcd
7 changed files with 43 additions and 33 deletions

View File

@@ -9,6 +9,8 @@ import (
"log"
"os"
"path/filepath"
"sigs.k8s.io/kustomize/kyaml/errors"
)
var _ FileSystem = fsOnDisk{}
@@ -128,7 +130,7 @@ func (fsOnDisk) ReadFile(name string) ([]byte, error) { return ioutil.ReadFile(n
// WriteFile delegates to ioutil.WriteFile with read/write permissions.
func (fsOnDisk) WriteFile(name string, c []byte) error {
return ioutil.WriteFile(name, c, 0666) //nolint:gosec
return errors.Wrap(ioutil.WriteFile(name, c, 0666)) //nolint:gosec
}
// Walk delegates to filepath.Walk.

View File

@@ -317,7 +317,7 @@ func toTypeMeta(ext interface{}) (yaml.TypeMeta, bool) {
}
apiVersion := m[versionKey].(string)
if g := m[groupKey].(string); g != "" {
if g, ok := m[groupKey].(string); ok && g != "" {
apiVersion = g + "/" + apiVersion
}
return yaml.TypeMeta{Kind: m[kindKey].(string), APIVersion: apiVersion}, true