honnef.co/go/tools@v0.5.0-0.dev.0.20240520180541-dcae280a5e87/quickfix/qf1010/testdata/src/example.com/CheckByteSlicePrinting/CheckByteSlicePrinting.go (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, b1, 2, []byte(""), b2, s)       //@ diag(`could convert argument to string`), diag(`could convert argument to string`), diag(`could convert argument to string`)
    22  	fmt.Print(Alias1{})                          //@ diag(`could convert argument to string`)
    23  	fmt.Print(Alias2{})                          //@ diag(`could convert argument to string`)
    24  	fmt.Print(Alias4{})                          //@ diag(`could convert argument to string`)
    25  	fmt.Fprint(nil, 1, b1, 2, []byte(""), 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(b4) //@ diag(`could convert argument to string`)
    31  }