This commit is contained in:
Adrien Marquès 2018-11-16 06:57:57 +01:00
parent 5f229709ad
commit c37893c209
4 changed files with 7 additions and 6 deletions

View File

@ -57,7 +57,7 @@ func NewReader(ctx *instruction.ExecutionContext, buildfile io.Reader) (*Reader,
// add each line as instruction // add each line as instruction
l, reader := 0, bufio.NewReader(buildfile) l, reader := 0, bufio.NewReader(buildfile)
eof := false eof := false
var section *[]instruction.T = nil // current section var section *[]instruction.T // current section
for { for {
l++ l++
if eof { if eof {
@ -139,8 +139,8 @@ func (r *Reader) Execute(_dryRun ...bool) error {
table := make([]tableSection, 0) table := make([]tableSection, 0)
index := make(map[string]int, 0) index := make(map[string]int, 0)
var pre *[]instruction.T = nil var pre *[]instruction.T
var preTable *tableSection = nil var preTable *tableSection
for secname, sec := range r.Content { for secname, sec := range r.Content {
@ -202,7 +202,7 @@ func execSection(section *[]instruction.T, ctx instruction.ExecutionContext, tse
for i, inst := range *section { for i, inst := range *section {
tsec.instructions[i].start = time.Now() tsec.instructions[i].start = time.Now()
var err error = nil var err error
if dryRun { if dryRun {
_, err = inst.DryRun(ctx) _, err = inst.DryRun(ctx)
} else { } else {

View File

@ -92,7 +92,7 @@ func DisplaySize(s string) int {
matches = reDots.FindAllString(s, -1) matches = reDots.FindAllString(s, -1)
for _, m := range matches { for _, m := range matches {
size -= len(m) size -= len(m)
size += 1 size++
} }
return size return size

View File

@ -12,7 +12,7 @@ var ErrUnknownExtension = errors.New("unknown extension format")
// ErrUnknownFormat is raised when the format cannot be guessed from the content of the file // ErrUnknownFormat is raised when the format cannot be guessed from the content of the file
var ErrUnknownFormat = errors.New("cannot infer format from content") var ErrUnknownFormat = errors.New("cannot infer format from content")
// ErrUnknownFormat is raised when required file does not exist // ErrFileNotExist is raised when required file does not exist
var ErrFileNotExist = errors.New("cannot find file") var ErrFileNotExist = errors.New("cannot find file")
// Load the current file and create the configuration format accordingly // Load the current file and create the configuration format accordingly

View File

@ -14,6 +14,7 @@ var ErrInvalidSyntax = fmt.Errorf("invalid instruction format")
// it can mean that you're not using the right version or that you've misspelled it // it can mean that you're not using the right version or that you've misspelled it
var ErrUnknownInstruction = fmt.Errorf("unknown instruction") var ErrUnknownInstruction = fmt.Errorf("unknown instruction")
// FileError is used for file-specific errors
type FileError struct { type FileError struct {
Reason string Reason string
File string File string