chore: implement comments from #16316 (#16616)

This commit is contained in:
Julien Robert
2023-06-22 10:07:00 +00:00
committed by GitHub
parent 99a570a7aa
commit 7149bcf7ea
4 changed files with 12 additions and 536 deletions
+4
View File
@@ -36,6 +36,10 @@ func (b *Builder) addMessageFlags(ctx context.Context, flagSet *pflag.FlagSet, m
return nil, fmt.Errorf("can't find field %s on %s", arg.ProtoField, messageType.Descriptor().FullName())
}
if arg.Optional && arg.Varargs {
return nil, fmt.Errorf("positional argument %s can't be both optional and varargs", arg.ProtoField)
}
if arg.Varargs {
if i != n-1 {
return nil, fmt.Errorf("varargs positional argument %s must be the last argument", arg.ProtoField)