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

View File

@ -92,7 +92,7 @@ func DisplaySize(s string) int {
matches = reDots.FindAllString(s, -1)
for _, m := range matches {
size -= len(m)
size += 1
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
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")
// 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
var ErrUnknownInstruction = fmt.Errorf("unknown instruction")
// FileError is used for file-specific errors
type FileError struct {
Reason string
File string