0

I want to pass some values to a (3rd party) function with a signature like this:

func Load(files ...string) error {

If I build up a slice of files like this:

var files []string
append(files, "...")
append(files, "...")

How do I pass my files slice to the function Load? This:

Load(files)

Results in this error:

cannot use files (type []string) as type string in argument to Load

sbs
  • 1,139
  • 3
  • 13
  • 19
  • This was asked just 3 hours ago. You need to use `...` like this: `Load(files...)`. – icza Mar 21 '16 at 10:26
  • There's absolutely no way I could have found that question and answer, but thanks, that is the correct answer – sbs Mar 21 '16 at 10:32

0 Answers0