(transport interface{})
| 773 | } |
| 774 | |
| 775 | func initMetaHeader(transport interface{}) string { |
| 776 | var b strings.Builder |
| 777 | var strippedGoVersion string |
| 778 | var strippedEsVersion string |
| 779 | var strippedTransportVersion string |
| 780 | |
| 781 | strippedEsVersion = buildStrippedVersion(Version) |
| 782 | strippedGoVersion = buildStrippedVersion(runtime.Version()) |
| 783 | |
| 784 | if _, ok := transport.(*elastictransport.Client); ok { |
| 785 | strippedTransportVersion = buildStrippedVersion(tpversion.Transport) |
| 786 | } else { |
| 787 | strippedTransportVersion = strippedEsVersion |
| 788 | } |
| 789 | |
| 790 | var duos = [][]string{ |
| 791 | { |
| 792 | "es", |
| 793 | strippedEsVersion, |
| 794 | }, |
| 795 | { |
| 796 | "go", |
| 797 | strippedGoVersion, |
| 798 | }, |
| 799 | { |
| 800 | "t", |
| 801 | strippedTransportVersion, |
| 802 | }, |
| 803 | { |
| 804 | "hc", |
| 805 | strippedGoVersion, |
| 806 | }, |
| 807 | } |
| 808 | |
| 809 | var arr []string |
| 810 | for _, duo := range duos { |
| 811 | arr = append(arr, strings.Join(duo, "=")) |
| 812 | } |
| 813 | b.WriteString(strings.Join(arr, ",")) |
| 814 | |
| 815 | return b.String() |
| 816 | } |
| 817 | |
| 818 | func buildStrippedVersion(version string) string { |
| 819 | v := reMetaVersion.FindStringSubmatch(version) |
no test coverage detected