type MD … // Get returns the metadata for a given key when they exist. // If there is no metadata, a nil slice and false are returned. func (m MD) Get(key string) ([]string, bool) { … } // Set sets the provided values for a given key. // The values will overwrite any existing values. // If no values provided, a key will be deleted. func (m MD) Set(key string, values ...string) { … } // Append appends additional values to the given key. func (m MD) Append(key string, values ...string) { … } func (m MD) setRequest(r *Request) { … } func (m MD) fromRequest(r *Request) { … } type metadataKey … // GetMetadata retrieves metadata from context.Context (previously attached with WithMetadata) func GetMetadata(ctx context.Context) (MD, bool) { … } // GetMetadataValue gets a specific metadata value by name from context.Context func GetMetadataValue(ctx context.Context, name string) (string, bool) { … } // WithMetadata attaches metadata map to a context.Context func WithMetadata(ctx context.Context, md MD) context.Context { … }