File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ func (h *Hound) New() bool {
31
31
return false
32
32
}
33
33
34
- err = h .parse (config )
34
+ err = h .parseConfig (config )
35
35
if err != nil {
36
36
return false
37
37
}
@@ -85,8 +85,8 @@ func (h *Hound) loadConfig() ([]byte, error) {
85
85
return ioutil .ReadFile (filename )
86
86
}
87
87
88
- // parse parses a configuration byte array and returns an error.
89
- func (h * Hound ) parse (config []byte ) error {
88
+ // parseConfig parses a configuration byte array and returns an error.
89
+ func (h * Hound ) parseConfig (config []byte ) error {
90
90
return yaml .Unmarshal (config , h )
91
91
}
92
92
@@ -95,11 +95,10 @@ func (h *Hound) parse(config []byte) error {
95
95
// will compile the pattern and store it in the cache. Returns a Regexp
96
96
// and an error.
97
97
func (h * Hound ) regexp (pattern string ) (* regexp.Regexp , error ) {
98
-
99
- // Ensure that we don't encounter a race condition where multiple goroutines
100
- // are attempting to read/write to the regexes map.
101
- defer func () { mutex .Unlock () }()
98
+ // Make sure that we don't encounter a race condition where multiple
99
+ // goroutines a
102
100
mutex .Lock ()
101
+ defer mutex .Unlock ()
103
102
104
103
if regexes [pattern ] != nil {
105
104
return regexes [pattern ], nil
Original file line number Diff line number Diff line change 16
16
- '\.test$'
17
17
` )
18
18
19
- if err := hound .parse (config ); err != nil {
20
- t .Fatalf ("Should parse - %s" , err )
19
+ if err := hound .parseConfig (config ); err != nil {
20
+ t .Fatalf ("Should parse config - %s" , err )
21
21
}
22
22
23
23
// Should fail with a warning
You can’t perform that action at this time.
0 commit comments