From 0d0eff71652a0b8fcbfe678763d88eb142a544f9 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 15 Nov 2012 11:46:00 -0800 Subject: [PATCH] os: add FileMode.IsRegular API change. R=golang-dev, r, iant, rsc CC=golang-dev https://golang.org/cl/6844048 --- src/pkg/os/types.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pkg/os/types.go b/src/pkg/os/types.go index ecb57872d52..c561ea04fb8 100644 --- a/src/pkg/os/types.go +++ b/src/pkg/os/types.go @@ -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