FAQ
You were missing some parens on the Mode, but otherwise it is perfect, it
fixed my permissions error. Thanks!
On Tuesday, May 21, 2013 3:54:13 PM UTC+8, Jan Mercl wrote:
On Tue, May 21, 2013 at 9:46 AM, Jon Renner wrote:
Can this be improved upon?

func isADirectory(path string) bool {
f, err := os.Open(path)
handleError(err)
stat, err := f.Stat()
handleError(err)
return stat.IsDir()
}
Not tested:

func isDir(pth string) (bool, error) {
fi, err := os.Stat(pth)
if err != nil {
return false, err
}

return fi.Mode.IsDir(), nil
}

-j
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 3 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 21, '13 at 7:46a
activeMay 21, '13 at 8:15a
posts3
users2
websitegolang.org

2 users in discussion

Jon Renner: 2 posts Jan Mercl: 1 post

People

Translate

site design / logo © 2022 Grokbase