diff options
author | Jakob Borg <jakob@nym.se> | 2016-05-04 07:15:56 +0000 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2016-05-04 07:15:56 +0000 |
commit | 6720906ee52a86902751abd4e6294eb4d56fc938 (patch) | |
tree | 6eee9f43e3e8278f27dd95b3f676d770478b3ed8 | |
parent | abb96802cb8621aaa42a7099b72b3fb7f20b8771 (diff) |
lib/ignore: Refactor: notMatched should be one of the constants
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3031
-rw-r--r-- | lib/ignore/ignore.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/ignore/ignore.go b/lib/ignore/ignore.go index 14e7de493b..493e0046ec 100644 --- a/lib/ignore/ignore.go +++ b/lib/ignore/ignore.go @@ -23,13 +23,12 @@ import ( ) const ( - resultInclude Result = 1 << iota - resultDeletable = 1 << iota - resultFoldCase = 1 << iota + resultNotMatched Result = 0 + resultInclude Result = 1 << iota + resultDeletable = 1 << iota + resultFoldCase = 1 << iota ) -var notMatched Result = 0 - type Pattern struct { pattern string match glob.Glob @@ -125,14 +124,14 @@ func (m *Matcher) Parse(r io.Reader, file string) error { func (m *Matcher) Match(file string) (result Result) { if m == nil { - return notMatched + return resultNotMatched } m.mut.Lock() defer m.mut.Unlock() if len(m.patterns) == 0 { - return notMatched + return resultNotMatched } if m.matches != nil { @@ -166,8 +165,8 @@ func (m *Matcher) Match(file string) (result Result) { } } - // Default to false. - return notMatched + // Default to not matching. + return resultNotMatched } // Patterns return a list of the loaded patterns, as they've been parsed |