diff --git a/param/errors.go b/param/errors.go index 64011e7..e6b9de6 100644 --- a/param/errors.go +++ b/param/errors.go @@ -63,8 +63,8 @@ func (n NestingError) Error() string { type SyntaxErrorSubtype int const ( - MissingOpeningBrace SyntaxErrorSubtype = iota + 1 - MissingClosingBrace + MissingOpeningBracket SyntaxErrorSubtype = iota + 1 + MissingClosingBracket ) // SyntaxError is an error type returned when a key is incorrectly formatted. @@ -83,11 +83,11 @@ func (s SyntaxError) Error() string { s.Key) switch s.Subtype { - case MissingOpeningBrace: - return prefix + fmt.Sprintf("expected opening brace, got %q", + case MissingOpeningBracket: + return prefix + fmt.Sprintf("expected opening bracket, got %q", s.ErrorPart) - case MissingClosingBrace: - return prefix + fmt.Sprintf("expected closing brace in %q", + case MissingClosingBracket: + return prefix + fmt.Sprintf("expected closing bracket in %q", s.ErrorPart) default: panic("switch is not exhaustive!") diff --git a/param/parse.go b/param/parse.go index 1213d8c..b8c069d 100644 --- a/param/parse.go +++ b/param/parse.go @@ -80,7 +80,7 @@ func keyed(tipe reflect.Type, key, keytail string) (string, string) { if keytail[0] != '[' { panic(SyntaxError{ Key: kpath(key, keytail), - Subtype: MissingOpeningBrace, + Subtype: MissingOpeningBracket, ErrorPart: keytail, }) } @@ -89,7 +89,7 @@ func keyed(tipe reflect.Type, key, keytail string) (string, string) { if idx == -1 { panic(SyntaxError{ Key: kpath(key, keytail), - Subtype: MissingClosingBrace, + Subtype: MissingClosingBracket, ErrorPart: keytail[1:], }) }