From f946781c74351d56e2700f6cd481c42fda290267 Mon Sep 17 00:00:00 2001 From: andig Date: Fri, 1 Nov 2024 18:21:47 +0100 Subject: [PATCH] chore: use cast.ToBoolE (#17030) --- util/format.go | 5 ----- util/format_test.go | 19 ------------------- 2 files changed, 24 deletions(-) diff --git a/util/format.go b/util/format.go index 17f521c57..80dc05cd3 100644 --- a/util/format.go +++ b/util/format.go @@ -16,11 +16,6 @@ import ( var re = regexp.MustCompile(`(?i)\${(\w+)(:([a-zA-Z0-9%.]+))?}`) -// Truish returns true if value is truish (true/1/on) -func Truish(s string) bool { - return s == "1" || strings.ToLower(s) == "true" || strings.ToLower(s) == "on" -} - // FormatValue will apply specific formatting in addition to standard sprintf func FormatValue(format string, val interface{}) string { switch typed := val.(type) { diff --git a/util/format_test.go b/util/format_test.go index 561da2bc3..ba6fea758 100644 --- a/util/format_test.go +++ b/util/format_test.go @@ -9,25 +9,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestTruish(t *testing.T) { - cases := []struct { - k string - v bool - }{ - {"", false}, - {"false", false}, - {"0", false}, - {"off", false}, - {"true", true}, - {"1", true}, - {"on", true}, - } - - for _, c := range cases { - assert.Equal(t, c.v, Truish(c.k)) - } -} - func TestReplace(t *testing.T) { cases := []struct { k string