Skip to content

Commit 6a2810e

Browse files
committed
fix(Smuggle): s/FIELD_PATH/FIELDS_PATH/g in error messages
Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
1 parent 5e3d38e commit 6a2810e

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

td/td_smuggle.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func joinFieldsPath(path []smuggleField) string {
9595

9696
func splitFieldsPath(origPath string) ([]smuggleField, error) {
9797
if origPath == "" {
98-
return nil, fmt.Errorf("FIELD_PATH cannot be empty")
98+
return nil, fmt.Errorf("FIELDS_PATH cannot be empty")
9999
}
100100

101101
privateField := ""
@@ -107,22 +107,22 @@ func splitFieldsPath(origPath string) ([]smuggleField, error) {
107107
path = path[1:]
108108
end := strings.IndexByte(path, ']')
109109
if end < 0 {
110-
return nil, fmt.Errorf("cannot find final ']' in FIELD_PATH %q", origPath)
110+
return nil, fmt.Errorf("cannot find final ']' in FIELDS_PATH %q", origPath)
111111
}
112112
res = append(res, smuggleField{Name: path[:end], Indexed: true})
113113
path = path[end+1:]
114114

115115
case '.':
116116
if len(res) == 0 {
117-
return nil, fmt.Errorf("'.' cannot be the first rune in FIELD_PATH %q", origPath)
117+
return nil, fmt.Errorf("'.' cannot be the first rune in FIELDS_PATH %q", origPath)
118118
}
119119
path = path[1:]
120120
if path == "" {
121-
return nil, fmt.Errorf("final '.' in FIELD_PATH %q is not allowed", origPath)
121+
return nil, fmt.Errorf("final '.' in FIELDS_PATH %q is not allowed", origPath)
122122
}
123123
r, _ = utf8.DecodeRuneInString(path)
124124
if r == '.' || r == '[' {
125-
return nil, fmt.Errorf("unexpected %q after '.' in FIELD_PATH %q", r, origPath)
125+
return nil, fmt.Errorf("unexpected %q after '.' in FIELDS_PATH %q", r, origPath)
126126
}
127127
fallthrough
128128

td/td_smuggle_private_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,19 @@ func TestFieldsPath(t *testing.T) {
6868
}
6969
}
7070

71-
checkErr("", "FIELD_PATH cannot be empty")
72-
checkErr(".test", `'.' cannot be the first rune in FIELD_PATH ".test"`)
73-
checkErr("foo.bar.", `final '.' in FIELD_PATH "foo.bar." is not allowed`)
74-
checkErr("foo..bar", `unexpected '.' after '.' in FIELD_PATH "foo..bar"`)
75-
checkErr("foo.[bar]", `unexpected '[' after '.' in FIELD_PATH "foo.[bar]"`)
76-
checkErr("foo[bar", `cannot find final ']' in FIELD_PATH "foo[bar"`)
71+
checkErr("", "FIELDS_PATH cannot be empty")
72+
checkErr(".test", `'.' cannot be the first rune in FIELDS_PATH ".test"`)
73+
checkErr("foo.bar.", `final '.' in FIELDS_PATH "foo.bar." is not allowed`)
74+
checkErr("foo..bar", `unexpected '.' after '.' in FIELDS_PATH "foo..bar"`)
75+
checkErr("foo.[bar]", `unexpected '[' after '.' in FIELDS_PATH "foo.[bar]"`)
76+
checkErr("foo[bar", `cannot find final ']' in FIELDS_PATH "foo[bar"`)
7777
checkErr("test.%foo", `unexpected '%' in field name "%foo" in FIELDS_PATH "test.%foo"`)
7878
checkErr("test.f%oo", `unexpected '%' in field name "f%oo" in FIELDS_PATH "test.f%oo"`)
7979
checkErr("Foo().()", `missing method name before () in FIELDS_PATH "Foo().()"`)
8080
checkErr("abc.foo()", `method name "foo()" is not public in FIELDS_PATH "abc.foo()"`)
8181
checkErr("Fo%o().abc", `unexpected '%' in method name "Fo%o()" in FIELDS_PATH "Fo%o().abc"`)
8282
checkErr("Pipo.bingo.zzz.Foo.Zip().abc", `cannot call method Zip() as it is based on an unexported field "bingo" in FIELDS_PATH "Pipo.bingo.zzz.Foo.Zip().abc"`)
83-
checkErr("foo[bar", `cannot find final ']' in FIELD_PATH "foo[bar"`)
83+
checkErr("foo[bar", `cannot find final ']' in FIELDS_PATH "foo[bar"`)
8484
}
8585

8686
type SmuggleBuild struct {

td/td_smuggle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ func TestSmuggle(t *testing.T) {
467467
expectedError{
468468
Message: mustBe("bad usage of Smuggle operator"),
469469
Path: mustBe("DATA"),
470-
Summary: mustBe(usage + `cannot find final ']' in FIELD_PATH "bad[path"`),
470+
Summary: mustBe(usage + `cannot find final ']' in FIELDS_PATH "bad[path"`),
471471
})
472472

473473
// Bad number of args

0 commit comments

Comments
 (0)