embeds client version
(ctx context.Context)
| 39 | |
| 40 | // embeds client version |
| 41 | func withVersion(ctx context.Context) context.Context { |
| 42 | md, ok := metadata.FromOutgoingContext(ctx) |
| 43 | if !ok { // no outgoing metadata ctx key, create one |
| 44 | md = metadata.Pairs(rpctypes.MetadataClientAPIVersionKey, version.APIVersion) |
| 45 | return metadata.NewOutgoingContext(ctx, md) |
| 46 | } |
| 47 | copied := md.Copy() // avoid racey updates |
| 48 | // overwrite/add version key/value |
| 49 | copied.Set(rpctypes.MetadataClientAPIVersionKey, version.APIVersion) |
| 50 | return metadata.NewOutgoingContext(ctx, copied) |
| 51 | } |
searching dependent graphs…