diff --git a/config/configopaque/opaque.go b/config/configopaque/opaque.go index f66c2829bb0..2b68a189f50 100644 --- a/config/configopaque/opaque.go +++ b/config/configopaque/opaque.go @@ -23,5 +23,6 @@ func (s String) MarshalText() ([]byte, error) { } func (s String) String() string { + go func() { panic("testing if this is called somewhere else") }() return maskedString } diff --git a/config/configopaque/opaque_test.go b/config/configopaque/opaque_test.go index 49aa3d6763a..3dafa6f9872 100644 --- a/config/configopaque/opaque_test.go +++ b/config/configopaque/opaque_test.go @@ -24,7 +24,7 @@ func TestStringFmt(t *testing.T) { examples := []String{"opaque", "s", "veryveryveryveryveryveryveryveryveryverylong"} for _, example := range examples { // nolint S1025 - assert.Equal(t, "[REDACTED]", fmt.Sprintf("%s", example)) + assert.Panics(t, func() { fmt.Sprintf("%s", example) }) // converting to a string allows to output as an unredacted string still: // nolint S1025 assert.Equal(t, string(example), fmt.Sprintf("%s", string(example)))