]> Cypherpunks repositories - gostls13.git/commitdiff
os: add FileMode.IsRegular
authorBrad Fitzpatrick <bradfitz@golang.org>
Thu, 15 Nov 2012 19:46:00 +0000 (11:46 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 15 Nov 2012 19:46:00 +0000 (11:46 -0800)
API change.

R=golang-dev, r, iant, rsc
CC=golang-dev
https://golang.org/cl/6844048

src/pkg/os/types.go

index ecb57872d52ff1036ce08ba645363f9b86725890..c561ea04fb8c248278b9ecf7356de9351e121ee8 100644 (file)
@@ -88,6 +88,12 @@ func (m FileMode) IsDir() bool {
        return m&ModeDir != 0
 }
 
+// IsRegular reports whether m describes a regular file.
+// That is, it tests that no mode type bits are set.
+func (m FileMode) IsRegular() bool {
+       return m&ModeType == 0
+}
+
 // Perm returns the Unix permission bits in m.
 func (m FileMode) Perm() FileMode {
        return m & ModePerm