go-demo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
455 B

package path
import (
"path/filepath"
"os"
"fmt"
)
// 模块中要导出的函数,必须首字母大写。
func Output(path string,) []string {
var array []string
err := filepath.Walk(path, func(path string, f os.FileInfo, err error) error {
if f == nil {
return err
}
if f.IsDir() {
return nil
}
array = append(array, path)
return nil
})
if err != nil {
fmt.Printf("filepath.Walk() returned %v\n", err)
}
return array
}