honnef.co/go/tools@v0.5.0-0.dev.0.20240520180541-dcae280a5e87/quickfix/qf1010/testdata/src/example.com/CheckByteSlicePrinting/CheckByteSlicePrinting.go.golden (about) 1 package pkg 2 3 import "fmt" 4 5 type Stringable []byte 6 7 func (*Stringable) String() string { return "" } 8 9 func fn() { 10 type ByteSlice []byte 11 type Alias1 = []byte 12 type Alias2 = ByteSlice 13 type Alias3 = byte 14 type Alias4 = []Alias3 15 var b1 []byte 16 var b2 ByteSlice 17 var b3 *Stringable 18 var b4 Stringable 19 20 var s string 21 fmt.Print(1, string(b1), 2, string([]byte("")), string(b2), s) //@ diag(`could convert argument to string`), diag(`could convert argument to string`), diag(`could convert argument to string`) 22 fmt.Print(string(Alias1{})) //@ diag(`could convert argument to string`) 23 fmt.Print(string(Alias2{})) //@ diag(`could convert argument to string`) 24 fmt.Print(string(Alias4{})) //@ diag(`could convert argument to string`) 25 fmt.Fprint(nil, 1, string(b1), 2, string([]byte("")), string(b2), s) //@ diag(`could convert argument to string`), diag(`could convert argument to string`), diag(`could convert argument to string`) 26 fmt.Print() 27 fmt.Fprint(nil) 28 29 fmt.Println(b3) 30 fmt.Println(string(b4)) //@ diag(`could convert argument to string`) 31 }