Update scripts/metricsgen/metricsgen.go

Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
This commit is contained in:
William Banfield
2022-05-12 13:51:34 -04:00
committed by GitHub
parent 6fa4a438a0
commit 1fb1b2f1d1

View File

@@ -289,11 +289,11 @@ func extractLabels(bl *ast.BasicLit) string {
if bl != nil {
t := reflect.StructTag(strings.Trim(bl.Value, "`"))
if v := t.Get(labelsTag); v != "" {
var res string
var res []string
for _, s := range strings.Split(v, ",") {
res += strconv.Quote(strings.TrimSpace(s)) + ","
res = append(res, strconv.Quote(strings.TrimSpace(s)))
}
return res
return strings.Join(res, ",")
}
}
return ""