comment fixup

This commit is contained in:
William Banfield
2022-05-09 18:55:11 -04:00
parent ea6c550a68
commit a7580e4e34
2 changed files with 5 additions and 2 deletions

View File

@@ -251,8 +251,11 @@ func findMetricsStruct(files map[string]*ast.File, structName string) (*ast.Stru
func parseMetricField(f *ast.Field) ParsedMetricField {
var comment string
if f.Doc != nil {
for _, c := range f.Doc.List {
for i, c := range f.Doc.List {
comment += strings.TrimPrefix(c.Text, "// ")
if i < len(f.Doc.List)-1 {
comment += " "
}
}
}
pmf := ParsedMetricField{

View File

@@ -18,7 +18,7 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics {
Namespace: namespace,
Subsystem: MetricsSubsystem,
Name: "field",
Help: "Height of the chain.We expect multi-line comments to parse correctly.",
Help: "Height of the chain. We expect multi-line comments to parse correctly.",
}, labels).With(labelsAndValues...),
}
}