diff --git a/internal/buildfile/reader.go b/internal/buildfile/reader.go index 09eec2f..aa65284 100644 --- a/internal/buildfile/reader.go +++ b/internal/buildfile/reader.go @@ -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 { diff --git a/internal/clifmt/symbols.go b/internal/clifmt/symbols.go index b9ecf96..b4dd20b 100644 --- a/internal/clifmt/symbols.go +++ b/internal/clifmt/symbols.go @@ -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 diff --git a/internal/cnf/loader.go b/internal/cnf/loader.go index 10a4aae..bec0f63 100644 --- a/internal/cnf/loader.go +++ b/internal/cnf/loader.go @@ -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 diff --git a/internal/instruction/errors.go b/internal/instruction/errors.go index 3ad5cc4..ecbc4e4 100644 --- a/internal/instruction/errors.go +++ b/internal/instruction/errors.go @@ -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