finfo,err := os.Stat("filename.txt") if err != nil { // no such file or dir return } if finfo.IsDir() { // it's a file } else { // it's a directory }原文链接:https://www.f2er.com/go/191327.html
finfo,err := os.Stat("filename.txt") if err != nil { // no such file or dir return } if finfo.IsDir() { // it's a file } else { // it's a directory }原文链接:https://www.f2er.com/go/191327.html