Improve error handling during var resolution.

This commit is contained in:
jregan
2019-02-24 10:17:11 -08:00
committed by Jeffrey Regan
parent f8c80b7335
commit 6bfd7cff72
8 changed files with 150 additions and 44 deletions

View File

@@ -22,6 +22,12 @@ import (
"sigs.k8s.io/kustomize/pkg/constants"
)
func TestNewOptionsToSilenceCodeInspectionError(t *testing.T) {
if NewOptions("foo", "bar") == nil {
t.Fatal("could not make new options")
}
}
func TestBuildValidate(t *testing.T) {
var cases = []struct {
name string

View File

@@ -94,7 +94,7 @@ func (a *flagsAndArgs) ExpandFileSource(fSys fs.FileSystem) error {
if key != "" {
if len(result) != 1 {
return fmt.Errorf(
"'pattern '%s' catches files %v, should catch only one.", pattern, result)
"'pattern '%s' catches files %v, should catch only one", pattern, result)
}
fileSource := fmt.Sprintf("%s=%s", key, result[0])
results = append(results, fileSource)