golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/completion/printf.txt (about) 1 This test checks various ranking of completion results related to printf. 2 3 -- flags -- 4 -ignore_extra_diags 5 6 -- printf.go -- 7 package printf 8 9 import "fmt" 10 11 func myPrintf(string, ...interface{}) {} 12 13 func _() { 14 var ( 15 aInt int //@item(printfInt, "aInt", "int", "var") 16 aFloat float64 //@item(printfFloat, "aFloat", "float64", "var") 17 aString string //@item(printfString, "aString", "string", "var") 18 aBytes []byte //@item(printfBytes, "aBytes", "[]byte", "var") 19 aStringer fmt.Stringer //@item(printfStringer, "aStringer", "fmt.Stringer", "var") 20 aError error //@item(printfError, "aError", "error", "var") 21 aBool bool //@item(printfBool, "aBool", "bool", "var") 22 ) 23 24 myPrintf("%d", a) //@rank(")", printfInt, printfFloat) 25 myPrintf("%s", a) //@rank(")", printfString, printfInt),rank(")", printfBytes, printfInt),rank(")", printfStringer, printfInt),rank(")", printfError, printfInt) 26 myPrintf("%w", a) //@rank(")", printfError, printfInt) 27 myPrintf("%x %[1]b", a) //@rank(")", printfInt, printfString) 28 29 fmt.Printf("%t", a) //@rank(")", printfBool, printfInt) 30 31 fmt.Fprintf(nil, "%f", a) //@rank(")", printfFloat, printfInt) 32 33 fmt.Sprintf("%[2]q %[1]*.[3]*[4]f", 34 a, //@rank(",", printfInt, printfFloat) 35 a, //@rank(",", printfString, printfFloat) 36 a, //@rank(",", printfInt, printfFloat) 37 a, //@rank(",", printfFloat, printfInt) 38 ) 39 }