Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 0665e22

Browse files
author
Bjørn
authored
Replace fmt.Sprintf with strconv.FormatBool (#24)
This is both faster and simpler.
1 parent ad3aee2 commit 0665e22

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

main.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func register(results []gaugeResult) {
233233
vulnerabilityGauge.Reset()
234234
for _, r := range results {
235235
for _, result := range r.results {
236-
vulnerabilityGauge.WithLabelValues(r.organization, r.project, result.title, result.severity, boolStr(result.ignored), boolStr(result.upgradeable), boolStr(result.patchable)).Set(float64(result.count))
236+
vulnerabilityGauge.WithLabelValues(r.organization, r.project, result.title, result.severity, strconv.FormatBool(result.ignored), strconv.FormatBool(result.upgradeable), strconv.FormatBool(result.patchable)).Set(float64(result.count))
237237
}
238238
}
239239
}
@@ -270,10 +270,6 @@ func collect(client *client, organization org) ([]gaugeResult, error) {
270270
return gaugeResults, nil
271271
}
272272

273-
func boolStr(b bool) string {
274-
return fmt.Sprintf("%t", b)
275-
}
276-
277273
type aggregateResult struct {
278274
title string
279275
severity string

0 commit comments

Comments
 (0)