fix(*): resolve new govet issues

Signed-off-by: Adam Reese <adam@reese.io>
pull/5470/head
Adam Reese 6 years ago
parent 2f9356c230
commit 14d8e97d2a
No known key found for this signature in database
GPG Key ID: 06F35E60A7A18DD6

@ -409,19 +409,13 @@ func createPatch(target *resource.Info, current runtime.Object) ([]byte, types.P
// returned from ConvertToVersion. Anything that's unstructured should
// use the jsonpatch.CreateMergePatch. Strategic Merge Patch is not supported
// on objects like CRDs.
_, isUnstructured := versionedObject.(runtime.Unstructured)
switch {
case runtime.IsNotRegisteredError(err), isUnstructured:
if _, ok := versionedObject.(runtime.Unstructured); ok {
// fall back to generic JSON merge patch
patch, err := jsonpatch.CreateMergePatch(oldData, newData)
return patch, types.MergePatchType, err
case err != nil:
return nil, types.StrategicMergePatchType, goerrors.Wrap(err, "failed to get versionedObject")
default:
patch, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, versionedObject)
return patch, types.StrategicMergePatchType, err
}
patch, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, versionedObject)
return patch, types.StrategicMergePatchType, err
}
func updateResource(c *Client, target *resource.Info, currentObj runtime.Object, force, recreate bool) error {

@ -117,7 +117,7 @@ func Templates(linter *support.Linter, values map[string]interface{}, namespace
func validateTemplatesDir(templatesPath string) error {
if fi, err := os.Stat(templatesPath); err != nil {
return errors.New("directory not found")
} else if err == nil && !fi.IsDir() {
} else if !fi.IsDir() {
return errors.New("not a directory")
}
return nil

@ -199,8 +199,7 @@ metadata:
for _, m := range manifests {
var sh SimpleHead
err := yaml.Unmarshal([]byte(m), &sh)
if err != nil {
if err := yaml.Unmarshal([]byte(m), &sh); err != nil {
// This is expected for manifests that are corrupt or empty.
t.Log(err)
continue
@ -208,8 +207,8 @@ metadata:
name := sh.Metadata.Name
//only keep track of non-hook manifests
if err == nil && s.hooks[name] == nil {
// only keep track of non-hook manifests
if s.hooks[name] == nil {
another := Manifest{
Content: m,
Name: name,

Loading…
Cancel
Save