mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-16 17:33:14 +00:00
Merge pull request #5961 from koba1t/refactor/nested_format_string
refactor: nested format string
This commit is contained in:
@@ -161,12 +161,12 @@ func (p *ExecPlugin) invokePlugin(input []byte) ([]byte, error) {
|
|||||||
_, err = f.Write(p.cfg)
|
_, err = f.Write(p.cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.WrapPrefixf(
|
return nil, errors.WrapPrefixf(
|
||||||
err, "%s", "writing plugin config to "+f.Name())
|
err, "writing plugin config to %s", f.Name())
|
||||||
}
|
}
|
||||||
err = f.Close()
|
err = f.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.WrapPrefixf(
|
return nil, errors.WrapPrefixf(
|
||||||
err, "%s", "closing plugin config file "+f.Name())
|
err, "closing plugin config file %s", f.Name())
|
||||||
}
|
}
|
||||||
cmd := exec.Command(
|
cmd := exec.Command(
|
||||||
p.path, append([]string{f.Name()}, p.args...)...)
|
p.path, append([]string{f.Name()}, p.args...)...)
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ Installation and setup instructions: https://kubernetes.io/docs/tasks/tools/inst
|
|||||||
command.Stderr = &stderr
|
command.Stderr = &stderr
|
||||||
err := command.Run()
|
err := command.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%w\n%s", err, stderr.String()+errMsg)
|
return fmt.Errorf("%w\n%s%s", err, stderr.String(), errMsg)
|
||||||
} else if stdout.String() == "" {
|
} else if stdout.String() == "" {
|
||||||
return fmt.Errorf("%s", stderr.String()+errMsg)
|
return fmt.Errorf("%s%s", stderr.String(), errMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// format and output
|
// format and output
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
package filesys
|
package filesys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||||
@@ -78,7 +77,7 @@ func ConfirmDir(fSys FileSystem, path string) (ConfirmedDir, error) {
|
|||||||
return "", errors.WrapPrefixf(err, "not a valid directory")
|
return "", errors.WrapPrefixf(err, "not a valid directory")
|
||||||
}
|
}
|
||||||
if f != "" {
|
if f != "" {
|
||||||
return "", errors.WrapPrefixf(errors.Errorf("file is not directory"), "%s", fmt.Sprintf("'%s'", path))
|
return "", errors.WrapPrefixf(errors.Errorf("file is not directory"), "'%s'", path)
|
||||||
}
|
}
|
||||||
return d, nil
|
return d, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user