-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
example: metadata #2500
example: metadata #2500
Conversation
} | ||
} | ||
|
||
func serverStreamingWithMetadata(c pb.GreeterClient, names []string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need examples for all the various stream types? Setting/reading metadata should be the same for all of them, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please change this so it is based on the new Echo service.
7beef85
to
846d544
Compare
for i, e := range t { | ||
fmt.Printf(" %d. %s\n", i, e) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either:
-
else { log.Fatal() }
, or -
remove the
if
and just assume it's present. Actually this will work and not output anything if it's missing, since werange
overt
, and ranging over anil
slice is fine.
In the second case...nothing bad happens if things are broken and the metadata is not present. Is that OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added else
.
if err != nil { | ||
log.Fatalf("failed to listen: %v", err) | ||
} | ||
fmt.Printf("server listening at port %v\n", port) | ||
fmt.Printf("server listening at port %v\n", *port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case port is zero, print lis.Addr()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
fixes #2480