From 798732dd45768ad46a60d894c5bf6d78bb3efddf Mon Sep 17 00:00:00 2001 From: Josh Humphries Date: Thu, 8 Mar 2018 10:34:04 -0500 Subject: [PATCH] relax some argument issues to warnings --- cmd/grpcurl/grpcurl.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/grpcurl/grpcurl.go b/cmd/grpcurl/grpcurl.go index 8656506..e07cb62 100644 --- a/cmd/grpcurl/grpcurl.go +++ b/cmd/grpcurl/grpcurl.go @@ -169,10 +169,10 @@ func main() { args = args[1:] } else { if *data != "" { - fail(nil, "The -d argument is not used with 'list' or 'describe' verb.") + warn("The -d argument is not used with 'list' or 'describe' verb.") } if len(rpcHeaders) > 0 { - fail(nil, "The -rpc-header argument is not used with 'list' or 'describe' verb.") + warn("The -rpc-header argument is not used with 'list' or 'describe' verb.") } if len(args) > 0 { symbol = args[0] @@ -190,7 +190,7 @@ func main() { fail(nil, "No host:port specified and no protoset specified.") } if len(protoset) > 0 && len(reflHeaders) > 0 { - fail(nil, "The -reflect-header argument is not used when -protoset files are used ") + warn("The -reflect-header argument is not used when -protoset files are used ") } ctx := context.Background() @@ -419,6 +419,11 @@ the method's request type will be sent. } +func warn(msg string, args ...interface{}) { + msg = fmt.Sprintf("Warning: %s\n", msg) + fmt.Fprintf(os.Stderr, msg, args...) +} + func fail(err error, msg string, args ...interface{}) { if err != nil { msg += ": %v"