Skip to content

Commit becd4f3

Browse files
authored
fix: Avoid printing invalid sep (#577)
Signed-off-by: Justin Chadwell <justin@unikraft.com>
1 parent 98b7aff commit becd4f3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mapper.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,12 @@ func sliceDecoder(r *Registry) MapperFunc {
541541
if ctx.Value.Flag != nil {
542542
t := ctx.Scan.Pop()
543543
// If decoding a flag, we need a value.
544+
tail := ""
545+
if sep != -1 {
546+
tail += string(sep) + "..."
547+
}
544548
if t.IsEOL() {
545-
return fmt.Errorf("missing value, expecting \"<arg>%c...\"", sep)
549+
return fmt.Errorf("missing value, expecting \"<arg>%s\"", tail)
546550
}
547551
switch v := t.Value.(type) {
548552
case string:

0 commit comments

Comments
 (0)