From b9e0f64a3956df471fb40ac27070aa258ac944d6 Mon Sep 17 00:00:00 2001 From: Jordan Jones Date: Thu, 15 Aug 2024 18:09:09 -0700 Subject: [PATCH 1/3] chore: test no side effects --- 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..0c22dec 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 } From 03d79f7f10404c4fbdffee13642d487a68fc69f4 Mon Sep 17 00:00:00 2001 From: Jordan Jones Date: Thu, 15 Aug 2024 18:17:25 -0700 Subject: [PATCH 2/3] debug --- pkg/kromgo/kromgo.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/kromgo/kromgo.go b/pkg/kromgo/kromgo.go index 0c22dec..5420113 100644 --- a/pkg/kromgo/kromgo.go +++ b/pkg/kromgo/kromgo.go @@ -35,6 +35,8 @@ func NewKromgoHandler(config configuration.KromgoConfig) (*KromgoHandler, error) size = 11 } + log.Info("badge gen", zap.Int("size", size), zap.String("font", font)) + badgeGenerator, err := badge.NewGenerator(font, size) if err != nil { return nil, err From e9c7f45c420cdbe3685850e9d463733f2e9743fa Mon Sep 17 00:00:00 2001 From: Jordan Jones Date: Thu, 15 Aug 2024 18:26:59 -0700 Subject: [PATCH 3/3] chore: sometimes its not empty its just 0 --- pkg/kromgo/kromgo.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/kromgo/kromgo.go b/pkg/kromgo/kromgo.go index 5420113..ba6551e 100644 --- a/pkg/kromgo/kromgo.go +++ b/pkg/kromgo/kromgo.go @@ -31,12 +31,10 @@ func NewKromgoHandler(config configuration.KromgoConfig) (*KromgoHandler, error) } size := config.Badge.Size - if size < 0 { + if size <= 0 { size = 11 } - log.Info("badge gen", zap.Int("size", size), zap.String("font", font)) - badgeGenerator, err := badge.NewGenerator(font, size) if err != nil { return nil, err