Skip to content
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

Merged
merged 17 commits into from
Dec 13, 2018
Merged

example: metadata #2500

merged 17 commits into from
Dec 13, 2018

Conversation

menghanl
Copy link
Contributor

@menghanl menghanl commented Dec 5, 2018

fixes #2480

examples/features/metadata/README.md Show resolved Hide resolved
examples/features/metadata/helloworld/helloworld.proto Outdated Show resolved Hide resolved
}
}

func serverStreamingWithMetadata(c pb.GreeterClient, names []string) {
Copy link
Member

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?

@dfawley dfawley assigned menghanl and unassigned dfawley Dec 6, 2018
Copy link
Member

@dfawley dfawley left a 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.

Documentation/grpc-metadata.md Outdated Show resolved Hide resolved
examples/features/metadata/README.md Outdated Show resolved Hide resolved
@menghanl menghanl assigned dfawley and unassigned menghanl Dec 6, 2018
for i, e := range t {
fmt.Printf(" %d. %s\n", i, e)
}
}
Copy link
Member

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 we range over t, and ranging over a nil slice is fine.

In the second case...nothing bad happens if things are broken and the metadata is not present. Is that OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added else.

@dfawley dfawley assigned menghanl and unassigned dfawley Dec 11, 2018
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)
Copy link
Member

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()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@menghanl menghanl merged commit 9d925ce into grpc:master Dec 13, 2018
@menghanl menghanl deleted the metadata_code branch December 13, 2018 22:45
@menghanl menghanl added the Type: Documentation Documentation or examples label Dec 13, 2018
@menghanl menghanl added this to the 1.18 Release milestone Dec 13, 2018
@dfawley dfawley changed the title examples: metadata example: metadata Dec 20, 2018
@dfawley dfawley added Type: Documentation Documentation or examples and removed Type: Documentation Documentation or examples labels Dec 20, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Documentation Documentation or examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

examples: metadata
2 participants