Fix NewBundle error return
Defer is executed at the very end of a functions. If we have named return paramteters Cleanp() function will overwrite function result. So if 'err' is not 'nil' Clenup() will overwrite 'err' with 'nil' Change-Id: I97bbce53be26281515a287b513a3727aa199260d
This commit is contained in:
parent
e2297e429d
commit
34cca34796
@ -16,6 +16,7 @@ import (
|
|||||||
"sigs.k8s.io/kustomize/v3/pkg/target"
|
"sigs.k8s.io/kustomize/v3/pkg/target"
|
||||||
"sigs.k8s.io/kustomize/v3/pkg/types"
|
"sigs.k8s.io/kustomize/v3/pkg/types"
|
||||||
|
|
||||||
|
"opendev.org/airship/airshipctl/pkg/log"
|
||||||
utilyaml "opendev.org/airship/airshipctl/pkg/util/yaml"
|
utilyaml "opendev.org/airship/airshipctl/pkg/util/yaml"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -89,7 +90,9 @@ func NewBundle(fSys fs.FileSystem, kustomizePath string, outputPath string) (bun
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
err = ldr.Cleanup()
|
if e := ldr.Cleanup(); e != nil {
|
||||||
|
log.Fatal("failed to cleanup loader ERROR: ", e)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
kt, err := target.NewKustTarget(ldr, rf, pf, pl)
|
kt, err := target.NewKustTarget(ldr, rf, pf, pl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user