Add support for static files
This commit is contained in:
parent
ce668ab5ad
commit
23d9ff7e00
16
goldsmith.go
16
goldsmith.go
@ -30,6 +30,10 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const (
|
||||
FILE_FLAG_STATIC = 1 << iota
|
||||
)
|
||||
|
||||
type stage struct {
|
||||
input, output chan *File
|
||||
}
|
||||
@ -149,7 +153,7 @@ func (gs *goldsmith) chain(s stage, c Chainer) {
|
||||
go c.Chain(gs, allowed, s.output)
|
||||
|
||||
for file := range s.input {
|
||||
if f.Filter(file.Path) {
|
||||
if file.flags&FILE_FLAG_STATIC != 0 || f.Filter(file.Path) {
|
||||
s.output <- file
|
||||
} else {
|
||||
allowed <- file
|
||||
@ -171,6 +175,16 @@ func (gs *goldsmith) NewFile(path string) (*File, error) {
|
||||
return file, nil
|
||||
}
|
||||
|
||||
func (gs *goldsmith) NewFileStatic(path string) (*File, error) {
|
||||
file, err := gs.NewFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
file.flags |= FILE_FLAG_STATIC
|
||||
return file, nil
|
||||
}
|
||||
|
||||
func (gs *goldsmith) RefFile(path string) error {
|
||||
if filepath.IsAbs(path) {
|
||||
return fmt.Errorf("absolute paths are not supported: %s", path)
|
||||
|
Loading…
Reference in New Issue
Block a user