Debian Codegraph @

simple/s1025/testdata/go1.9/CheckRedundantSprintf/LintRedundantSprintf.go.golden

raw
1 package pkg
2
3 import "fmt"
4
5 type T6 string
6 type T9 string
7
8 type MyByte byte
9
10 type Alias = byte
11 type T13 = []byte
12 type T14 = []Alias
13
14 type T15 = string
15 type T16 = T9
16 type T17 = T6
17
18 func (T6) String() string { return "" }
19
20 func (T9) Format(f fmt.State, c rune) {}
21
22 func fn() {
23 var t12 []Alias
24 var t13 T13
25 var t14 T14
26 var t15 T15
27 var t16 T16
28 var t17 T17
29
30 _ = string(t12) //@ diag(`underlying type is a slice of bytes`)
31 _ = string(t13) //@ diag(`underlying type is a slice of bytes`)
32 _ = string(t14) //@ diag(`underlying type is a slice of bytes`)
33 _ = t15 //@ diag(`is already a string`)
34 _ = t17.String() //@ diag(`should use String() instead of fmt.Sprintf`)
35
36 // don't simplify types that implement fmt.Formatter
37 _ = fmt.Sprintf("%s", t16)
38 }