Skip to content

Commit

Permalink
ext/featurens: add missing lock
Browse files Browse the repository at this point in the history
  • Loading branch information
jzelinskie committed Jan 23, 2017
1 parent cda3d48 commit 03b8cd9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ext/featurens/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ type Detector interface {
// layer.
Detect(tarutil.FilesMap) (*database.Namespace, error)

// RequireFilenames returns the list of files required to be in the FilesMap
// RequiredFilenames returns the list of files required to be in the FilesMap
// provided to the Detect method.
// TODO(jzelinskie): strip "/" prefix
//
// Filenames must not begin with "/".
RequiredFilenames() []string
}

Expand Down Expand Up @@ -94,15 +95,17 @@ func Detect(files tarutil.FilesMap) (*database.Namespace, error) {
// RequiredFilenames returns the total list of files required for all
// registered Detectors.
func RequiredFilenames() (files []string) {
detectorsM.RLock()
defer detectorsM.RUnlock()

for _, detector := range detectors {
files = append(files, detector.RequiredFilenames()...)
}

return
}

// TestData represents the data used to test an implementation of
// NameSpaceDetector.
// TestData represents the data used to test an implementation of Detector.
type TestData struct {
Files tarutil.FilesMap
ExpectedNamespace *database.Namespace
Expand Down

0 comments on commit 03b8cd9

Please sign in to comment.