我正在尝试在文件夹中查找文件的内容,因此我列出了文件夹中的内容,然后在循环浏览它时尝试读取文件。
files, _ := ioutil.ReadDir("documents/")
for _, f := range files {
//fmt.Println(f.Name())
z := "documents/" + f.Name()
fmt.Println(z) // prints out 'documents/*doc name*' recursively
z, err := ioutil.ReadFile(z) // This line throws up the error
我得到的错误是:test.go:85: cannot assign []byte to z (type string) in multiple assignment。