Skip to content

Commit 9b1cdb9

Browse files
committed
[md_doc] c2
1 parent 4aa8f7b commit 9b1cdb9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

metadata/metadata.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ func (md MD) Copy() MD {
9494

9595
// Get obtains the values for a given key.
9696
//
97-
// All keys are converted to lowercase.
97+
// k is converted to lowercase before searching in md.
9898
func (md MD) Get(k string) []string {
9999
k = strings.ToLower(k)
100100
return md[k]
101101
}
102102

103103
// Set sets the value of a given key with a slice of values.
104104
//
105-
// All keys are converted to lowercase.
105+
// k is converted to lowercase before storing in md.
106106
func (md MD) Set(k string, vals ...string) {
107107
if len(vals) == 0 {
108108
return
@@ -114,7 +114,7 @@ func (md MD) Set(k string, vals ...string) {
114114
// Append adds the values to key k, not overwriting what was already stored at
115115
// that key.
116116
//
117-
// All keys are converted to lowercase.
117+
// k is converted to lowercase before storing in md.
118118
func (md MD) Append(k string, vals ...string) {
119119
if len(vals) == 0 {
120120
return
@@ -155,10 +155,6 @@ func NewOutgoingContext(ctx context.Context, md MD) context.Context {
155155
// AppendToOutgoingContext returns a new context with the provided kv merged
156156
// with any existing metadata in the context. Please refer to the documentation
157157
// of Pairs for a description of kv.
158-
//
159-
// Unlike Pairs, the keys are not turned into lowercase. Users of
160-
// FromOutgoingContext need to handle them accordingly. Read
161-
// FromOutgoingContext's doc for more details.
162158
func AppendToOutgoingContext(ctx context.Context, kv ...string) context.Context {
163159
if len(kv)%2 == 1 {
164160
panic(fmt.Sprintf("metadata: AppendToOutgoingContext got an odd number of input pairs for metadata: %d", len(kv)))
@@ -210,7 +206,7 @@ func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) {
210206

211207
// FromOutgoingContext returns the outgoing metadata in ctx if it exists.
212208
//
213-
// All keys in the return MD are lowercase.
209+
// All keys in the returned MD are lowercase.
214210
func FromOutgoingContext(ctx context.Context) (MD, bool) {
215211
raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD)
216212
if !ok {

0 commit comments

Comments
 (0)