ext/featurens: add missing lock
This commit is contained in:
parent
cda3d4819c
commit
03b8cd9a45
@ -41,9 +41,10 @@ type Detector interface {
|
|||||||
// layer.
|
// layer.
|
||||||
Detect(tarutil.FilesMap) (*database.Namespace, error)
|
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.
|
// provided to the Detect method.
|
||||||
// TODO(jzelinskie): strip "/" prefix
|
//
|
||||||
|
// Filenames must not begin with "/".
|
||||||
RequiredFilenames() []string
|
RequiredFilenames() []string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +95,9 @@ func Detect(files tarutil.FilesMap) (*database.Namespace, error) {
|
|||||||
// RequiredFilenames returns the total list of files required for all
|
// RequiredFilenames returns the total list of files required for all
|
||||||
// registered Detectors.
|
// registered Detectors.
|
||||||
func RequiredFilenames() (files []string) {
|
func RequiredFilenames() (files []string) {
|
||||||
|
detectorsM.RLock()
|
||||||
|
defer detectorsM.RUnlock()
|
||||||
|
|
||||||
for _, detector := range detectors {
|
for _, detector := range detectors {
|
||||||
files = append(files, detector.RequiredFilenames()...)
|
files = append(files, detector.RequiredFilenames()...)
|
||||||
}
|
}
|
||||||
@ -101,8 +105,7 @@ func RequiredFilenames() (files []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestData represents the data used to test an implementation of
|
// TestData represents the data used to test an implementation of Detector.
|
||||||
// NameSpaceDetector.
|
|
||||||
type TestData struct {
|
type TestData struct {
|
||||||
Files tarutil.FilesMap
|
Files tarutil.FilesMap
|
||||||
ExpectedNamespace *database.Namespace
|
ExpectedNamespace *database.Namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user