append第二个参数不接受切片类型。
截图代码改成:
for _, v := range files {
for _, urlInFile := range util.ReadFile(v) {
urls = append(urls, urlInFile)
}
}
或者自己定义一个合并Slice得方法
func MergeSlice(s1 []string, s2 []string) []string {
slice := make([]string, len(s1)+len(s2))
copy(slice, s1)
copy(slice[len(s1):], s2)
return slice
}
for _, v := range files {
urls = MergeSlice(urls, util.ReadFile(v))
}