Tuesday, November 28, 2017

go lang, cannot use columns (type []string) as type string in argument to string

i want to used type []string to ...string when call some function with variable parameters. in go lang code.

write below code:

func f(p ...string){
    // ...
}

correct code:
var p []string
f(p...)

error code:
var p []string
f(p)

it said:
cannot use columns (type []string) as type string in argument to string

No comments: