-
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
Fix doc #1221
Fix doc #1221
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,12 +81,12 @@ func Pairs(kv ...string) MD { | |
return md | ||
} | ||
|
||
// Len returns the number of items in md. | ||
// Len returns the number of items in MD. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, "md" is correct here (that's the variable name; MD is the type name). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The usage is inconsistent. In line 130 and several other places, MD is used. I'll change all of them to md then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another question: do you think using the object name "md" by itself is sufficient or should more readable name be used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Godocs often refers to parameters or receivers by their name; I think this is fine. |
||
func (md MD) Len() int { | ||
return len(md) | ||
} | ||
|
||
// Copy returns a copy of md. | ||
// Copy returns a copy of MD. | ||
func (md MD) Copy() MD { | ||
return Join(md) | ||
} | ||
|
@@ -112,12 +112,12 @@ func NewContext(ctx context.Context, md MD) context.Context { | |
return NewOutgoingContext(ctx, md) | ||
} | ||
|
||
// NewIncomingContext creates a new context with incoming md attached. | ||
// NewIncomingContext creates a new context with incoming MD attached. | ||
func NewIncomingContext(ctx context.Context, md MD) context.Context { | ||
return context.WithValue(ctx, mdIncomingKey{}, md) | ||
} | ||
|
||
// NewOutgoingContext creates a new context with outgoing md attached. | ||
// NewOutgoingContext creates a new context with outgoing MD attached. | ||
func NewOutgoingContext(ctx context.Context, md MD) context.Context { | ||
return context.WithValue(ctx, mdOutgoingKey{}, md) | ||
} | ||
|
@@ -128,15 +128,15 @@ func FromContext(ctx context.Context) (md MD, ok bool) { | |
} | ||
|
||
// FromIncomingContext returns the incoming 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. | ||
// returned md should be immutable. Writing to it may cause races. | ||
// Modification should be made to copies of the returned md. | ||
func FromIncomingContext(ctx context.Context) (md MD, ok bool) { | ||
md, ok = ctx.Value(mdIncomingKey{}).(MD) | ||
return | ||
} | ||
|
||
// FromOutgoingContext returns the outgoing MD in ctx if it exists. The | ||
// returned md should be immutable, writing to it may cause races. | ||
// returned md should be immutable. Writing to it may cause races. | ||
// Modification should be made to the copies of the returned md. | ||
func FromOutgoingContext(ctx context.Context) (md MD, ok bool) { | ||
md, ok = ctx.Value(mdOutgoingKey{}).(MD) | ||
|
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.
used by the grpclb balancer