Er, the expression mode & 0111 evaluates whether a file mode is executable by authorized users. mode | 0111 would always yield a file mode with all executable bits enabled.
On Tuesday, June 12, 2012 at 4:52:27 PM UTC-5, Kyle Lemons wrote: > > From http://golang.org/pkg/os/#FileMode > "The nine least-significant bits are the standard Unix rwxrwxrwx > permissions." > > Thus, mode | 0111 will tell you if it's executable by somebody. Whether > it's executable by you is another matter. > > On Tue, Jun 12, 2012 at 2:34 PM, Archos <raul...@sent.com <javascript:>> > wrote: > >> How to check if a file is executable? >> >> I can get the permissions of a file, like: >> >> info, _ := os.Stat(name) >> mode := info.Mode() >> > > -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.