func cloneMetadata(md metadata.MD, copiedKeys ...string) metadata.MD {
	newMd := make(metadata.MD)
	for k, vv := range md {
		var found bool
		if len(copiedKeys) == 0 {
			found = true
		} else {
			for _, allowedKey := range copiedKeys {
				if strings.EqualFold(allowedKey, k) {
					found = true
					break
				}
			}
		}
		if !found {
			continue
		}
		newMd[k] = make([]string, len(vv))
		copy(newMd[k], vv)
	}
	return newMd
}
// cloneMetadata clones a given md set.
cloneMetadata clones a given md set.
// cloneMetadata clones a given md set .
func cloneMetadata(md metadata.MD, copiedKeys ...string) metadata.MD {
	newMd := make(metadata.MD)
	for k, vv := range md {
		var found bool
		if len(copiedKeys) == 0 {
			found = true
		} else {
			for _, allowedKey := range copiedKeys {
				if strings.EqualFold(allowedKey, k) {
					found = true
					break
				}
			}
		}
		if !found {
			continue
		}
		newMd[k] = make([]string, len(vv))
		copy(newMd[k], vv)
	}
	return newMd
}
func cloneMetadata ( md metadata . MD , copiedKeys ... string ) metadata . MD { newMd := make ( metadata . MD ) for k , vv := range md { var found bool if len ( copiedKeys ) == 0 { found = true } else { for _ , allowedKey := range copiedKeys { if strings . EqualFold ( allowedKey , k ) { found = true break } } } if ! found { continue } newMd [ k ] = make ( [ ] string , len ( vv ) ) copy ( newMd [ k ] , vv ) } return newMd }
cloneMetadata clones a given md set.
cloneMetadata clones a given md set .