From b8f6de95dd2e64c9dbf2a11844c9eec88a84b517 Mon Sep 17 00:00:00 2001 From: Jordan Jones Date: Thu, 15 Aug 2024 18:35:43 -0700 Subject: [PATCH] chore: no side effects (#68) * chore: test no side effects * debug * chore: sometimes its not empty its just 0 --- pkg/kromgo/kromgo.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/kromgo/kromgo.go b/pkg/kromgo/kromgo.go index a3b13fc..ba6551e 100644 --- a/pkg/kromgo/kromgo.go +++ b/pkg/kromgo/kromgo.go @@ -25,16 +25,17 @@ type KromgoHandler struct { func NewKromgoHandler(config configuration.KromgoConfig) (*KromgoHandler, error) { var badgeGenerator *badge.Generator - if config.Badge.Font == "" { - // This font is included in the container by default. - config.Badge.Font = "Verdana.ttf" + font := config.Badge.Font + if font == "" { + font = "Verdana.ttf" } - if config.Badge.Size < 0 { - config.Badge.Size = 11 + size := config.Badge.Size + if size <= 0 { + size = 11 } - badgeGenerator, err := badge.NewGenerator(config.Badge.Font, config.Badge.Size) + badgeGenerator, err := badge.NewGenerator(font, size) if err != nil { return nil, err }