buidlctl: upon error add line number in addition to filename

Signed-off-by: Tibor Vass <tibor@docker.com>
v0.8
Tibor Vass 2020-04-29 20:37:05 +00:00
parent 365a58177e
commit da4e440dbd
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,7 @@
package errdefs
import (
fmt "fmt"
"fmt"
"io"
"strings"
@ -63,6 +63,7 @@ func (s *Source) Print(w io.Writer) error {
}
var p int
prepadStart := start
for {
if p >= pad {
break
@ -78,7 +79,7 @@ func (s *Source) Print(w io.Writer) error {
p++
}
fmt.Fprintf(w, "%s\n--------------------\n", s.Filename)
fmt.Fprintf(w, "%s:%d\n--------------------\n", s.Filename, prepadStart)
for i := start; i <= end; i++ {
pfx := " "
if containsLine(s.Locations, i) {