fmt.Sprintf("%s", x)
unnecessarily SCC-S1025There are more accessible and efficient ways of getting a value's string
representation in many instances. Whenever a value's underlying type is a
string
already, or the type has a String()
method, they should be used
directly.
Given the following shared definitions:
type T1 string
type T2 int
func (T2) String() string { return "Hello, world" }
var x string
var y T1
var z T2
fmt.Sprintf("%s", x)
fmt.Sprintf("%s", y)
fmt.Sprintf("%s", z)
x
string(y)
z.String()