blob: 4787498ce7f5e40297657fec60790b9f5aa28dd4 [file] [log] [blame]
package variadic
func foo(i int, strs ...string) {}
func bar() []string { //@item(vFunc, "bar", "func() []string", "func")
return nil
}
func _() {
var (
i int //@item(vInt, "i", "int", "var")
s string //@item(vStr, "s", "string", "var")
ss []string //@item(vStrSlice, "ss", "[]string", "var")
v interface{} //@item(vIntf, "v", "interface{}", "var")
)
foo() //@rank(")", vInt, vStr),rank(")", vInt, vStrSlice)
foo(123, ) //@rank(")", vStr, vInt),rank(")", vStrSlice, vInt)
foo(123, "", ) //@rank(")", vStr, vInt),rank(")", vStr, vStrSlice)
foo(123, s, "") //@rank(", \"", vStr, vStrSlice)
// snippet will add the "..." for you
foo(123, ) //@snippet(")", vStrSlice, "ss...", "ss..."),snippet(")", vFunc, "bar()...", "bar()..."),snippet(")", vStr, "s", "s")
// don't add "..." for interface{}
foo(123, ) //@snippet(")", vIntf, "v", "v")
}
func qux(...func()) {}
func f() {} //@item(vVarArg, "f", "func()", "func")
func _() {
qux(f) //@snippet(")", vVarArg, "f", "f")
}
func _() {
foo(0, []string{}...) //@complete(")")
}