Merge pull request #5961 from koba1t/refactor/nested_format_string

refactor: nested format string
This commit is contained in:
Kubernetes Prow Robot
2025-08-17 14:27:07 -07:00
committed by GitHub
3 changed files with 5 additions and 6 deletions

View File

@@ -161,12 +161,12 @@ func (p *ExecPlugin) invokePlugin(input []byte) ([]byte, error) {
_, err = f.Write(p.cfg)
if err != nil {
return nil, errors.WrapPrefixf(
err, "%s", "writing plugin config to "+f.Name())
err, "writing plugin config to %s", f.Name())
}
err = f.Close()
if err != nil {
return nil, errors.WrapPrefixf(
err, "%s", "closing plugin config file "+f.Name())
err, "closing plugin config file %s", f.Name())
}
cmd := exec.Command(
p.path, append([]string{f.Name()}, p.args...)...)

View File

@@ -52,9 +52,9 @@ Installation and setup instructions: https://kubernetes.io/docs/tasks/tools/inst
command.Stderr = &stderr
err := command.Run()
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() == "" {
return fmt.Errorf("%s", stderr.String()+errMsg)
return fmt.Errorf("%s%s", stderr.String(), errMsg)
}
// format and output

View File

@@ -4,7 +4,6 @@
package filesys
import (
"fmt"
"path/filepath"
"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")
}
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
}