add more comments to metadata Fromcontext (#986)

This commit is contained in:
Menghan Li 2016-11-16 17:42:18 -08:00 committed by Qi Zhao
parent 8551858757
commit b13ef79499
1 changed files with 2 additions and 0 deletions

View File

@ -141,6 +141,8 @@ func NewContext(ctx context.Context, md MD) context.Context {
}
// FromContext returns the MD in ctx if it exists.
// The returned md should be immutable, writing to it may cause races.
// Modification should be made to the copies of the returned md.
func FromContext(ctx context.Context) (md MD, ok bool) {
md, ok = ctx.Value(mdKey{}).(MD)
return