Skip to content

Commit

Permalink
style adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Apr 26, 2016
1 parent aaf3c19 commit 196ff6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions hound.go
Expand Up @@ -31,7 +31,7 @@ func (h *Hound) New() bool {
return false
}

err = h.parse(config)
err = h.parseConfig(config)
if err != nil {
return false
}
Expand Down Expand Up @@ -85,8 +85,8 @@ func (h *Hound) loadConfig() ([]byte, error) {
return ioutil.ReadFile(filename)
}

// parse parses a configuration byte array and returns an error.
func (h *Hound) parse(config []byte) error {
// parseConfig parses a configuration byte array and returns an error.
func (h *Hound) parseConfig(config []byte) error {
return yaml.Unmarshal(config, h)
}

Expand All @@ -95,11 +95,10 @@ func (h *Hound) parse(config []byte) error {
// will compile the pattern and store it in the cache. Returns a Regexp
// and an error.
func (h *Hound) regexp(pattern string) (*regexp.Regexp, error) {

// Ensure that we don't encounter a race condition where multiple goroutines
// are attempting to read/write to the regexes map.
defer func() { mutex.Unlock() }()
// Make sure that we don't encounter a race condition where multiple
// goroutines a
mutex.Lock()
defer mutex.Unlock()

if regexes[pattern] != nil {
return regexes[pattern], nil
Expand Down
4 changes: 2 additions & 2 deletions hound_test.go
Expand Up @@ -16,8 +16,8 @@ skip:
- '\.test$'
`)

if err := hound.parse(config); err != nil {
t.Fatalf("Should parse - %s", err)
if err := hound.parseConfig(config); err != nil {
t.Fatalf("Should parse config - %s", err)
}

// Should fail with a warning
Expand Down

0 comments on commit 196ff6d

Please sign in to comment.