update filter interface
This commit is contained in:
parent
966201a95f
commit
bf1f01b9bf
@ -94,7 +94,7 @@ func (context *Context) step() {
|
||||
}
|
||||
|
||||
for _, fileFilter := range fileFilters {
|
||||
if accept, err = fileFilter.Accept(context, inputFile); err != nil {
|
||||
if accept, err = fileFilter.Accept(inputFile); err != nil {
|
||||
context.goldsmith.fault(fileFilter.Name(), inputFile, err)
|
||||
return
|
||||
}
|
||||
|
14
goldsmith.go
14
goldsmith.go
@ -82,7 +82,20 @@ func (goldsmith *Goldsmith) End(targetDir string) []error {
|
||||
}
|
||||
|
||||
context := goldsmith.contexts[len(goldsmith.contexts)-1]
|
||||
|
||||
export:
|
||||
for file := range context.outputFiles {
|
||||
for _, fileFilter := range goldsmith.fileFilters {
|
||||
accept, err := fileFilter.Accept(file)
|
||||
if err != nil {
|
||||
goldsmith.fault(fileFilter.Name(), file, err)
|
||||
continue export
|
||||
}
|
||||
if !accept {
|
||||
continue export
|
||||
}
|
||||
}
|
||||
|
||||
goldsmith.exportFile(file)
|
||||
}
|
||||
|
||||
@ -103,6 +116,7 @@ func (goldsmith *Goldsmith) storeFile(context *Context, outputFile *File, inputF
|
||||
if goldsmith.fileCache != nil {
|
||||
goldsmith.fileCache.storeFile(context, outputFile, inputFiles)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (goldsmith *Goldsmith) removeUnreferencedFiles() {
|
||||
|
@ -18,7 +18,7 @@ type Component interface {
|
||||
|
||||
type Filter interface {
|
||||
Component
|
||||
Accept(context *Context, file *File) (bool, error)
|
||||
Accept(file *File) (bool, error)
|
||||
}
|
||||
|
||||
type Plugin interface {
|
||||
|
Loading…
Reference in New Issue
Block a user