Cleanup
This commit is contained in:
parent
bbd3252541
commit
95079bca8e
17
core.go
17
core.go
@ -40,7 +40,12 @@ type goldsmith struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gs *goldsmith) pushContext(plug Plugin) *context {
|
func (gs *goldsmith) pushContext(plug Plugin) *context {
|
||||||
ctx := &context{gs: gs, plug: plug, output: make(chan *file)}
|
ctx := &context{
|
||||||
|
gs: gs,
|
||||||
|
plug: plug,
|
||||||
|
output: make(chan *file),
|
||||||
|
}
|
||||||
|
|
||||||
if len(gs.contexts) > 0 {
|
if len(gs.contexts) > 0 {
|
||||||
ctx.input = gs.contexts[len(gs.contexts)-1].output
|
ctx.input = gs.contexts[len(gs.contexts)-1].output
|
||||||
}
|
}
|
||||||
@ -75,11 +80,7 @@ func (gs *goldsmith) cleanupFiles() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
relPath, err := filepath.Rel(gs.dstDir, path)
|
relPath, _ := filepath.Rel(gs.dstDir, path)
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if contained, _ := gs.refs[relPath]; contained {
|
if contained, _ := gs.refs[relPath]; contained {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -116,12 +117,14 @@ func (gs *goldsmith) referenceFile(path string) {
|
|||||||
|
|
||||||
func (gs *goldsmith) fault(f *file, err error) {
|
func (gs *goldsmith) fault(f *file, err error) {
|
||||||
gs.errorMtx.Lock()
|
gs.errorMtx.Lock()
|
||||||
|
defer gs.errorMtx.Unlock()
|
||||||
|
|
||||||
ferr := &Error{Err: err}
|
ferr := &Error{Err: err}
|
||||||
if f != nil {
|
if f != nil {
|
||||||
ferr.Path = f.path
|
ferr.Path = f.path
|
||||||
}
|
}
|
||||||
|
|
||||||
gs.errors = append(gs.errors, ferr)
|
gs.errors = append(gs.errors, ferr)
|
||||||
gs.errorMtx.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -31,11 +31,7 @@ func (*loader) Initialize(ctx Context) error {
|
|||||||
go scanDir(ctx.SrcDir(), files, nil)
|
go scanDir(ctx.SrcDir(), files, nil)
|
||||||
|
|
||||||
for path := range files {
|
for path := range files {
|
||||||
relPath, err := filepath.Rel(ctx.SrcDir(), path)
|
relPath, _ := filepath.Rel(ctx.SrcDir(), path)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
f := NewFileFromAsset(relPath, path)
|
f := NewFileFromAsset(relPath, path)
|
||||||
ctx.DispatchFile(f)
|
ctx.DispatchFile(f)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user