~foosoft/goldsmith

8738157703920d0abd6b521a25842e801147f8fd — Alex Yatskov 9 years ago fa571ba
Cleanup
2 files changed, 8 insertions(+), 6 deletions(-)

M goldsmith.go
M types.go
M goldsmith.go => goldsmith.go +6 -4
@@ 23,6 23,7 @@
package goldsmith

import (
	"bytes"
	"os"
	"path"
	"path/filepath"


@@ 66,6 67,7 @@ func (gs *goldsmith) scan(srcDir string) {
		file := File{
			Path: relPath,
			Meta: make(map[string]interface{}),
			Buff: new(bytes.Buffer),
		}

		var f *os.File


@@ 120,12 122,12 @@ func (gs *goldsmith) chainMultiple(s stage, cm ChainerMultiple) {
	}
}

func (gs *goldsmith) Chain(ctx *Context) Goldsmith {
func (gs *goldsmith) Chain(ctx Context) Goldsmith {
	if gs.err != nil {
		return gs
	}

	if gs.err = ctx.Err; gs.err != nil {
	if gs.err = ctx.Err; gs.err == nil {
		switch c := ctx.Chainer.(type) {
		case ChainerSingle:
			go gs.chainSingle(gs.makeStage(), c)


@@ 149,13 151,13 @@ func (gs *goldsmith) Complete(dstDir string) ([]File, error) {
			}

			var f *os.File
			if f, file.Err = os.Create(absPath); f == nil {
			if f, file.Err = os.Create(absPath); file.Err == nil {
				_, file.Err = f.Write(file.Buff.Bytes())
				f.Close()
			}
		}

		file.Buff.Reset()
		file.Buff = nil
		files = append(files, file)
	}


M types.go => types.go +2 -2
@@ 25,7 25,7 @@ package goldsmith
import "bytes"

type Goldsmith interface {
	Chain(ctx *Context) Goldsmith
	Chain(ctx Context) Goldsmith
	Complete(dstDir string) ([]File, error)
}



@@ 40,7 40,7 @@ type ChainerMultiple interface {
type File struct {
	Path string
	Meta map[string]interface{}
	Buff bytes.Buffer
	Buff *bytes.Buffer
	Err  error
}


Do not follow this link