1
0
mirror of https://github.com/containers/skopeo.git synced 2025-05-05 06:27:03 +00:00

Fix tabelating output in (skopeo inspect --format)

tabwriter buffers lines that contain \t in memory, and only
writes them out on a .Flush(). So actually call that.

Without this, things like
> --format 'name\tdigest\tlabels\n{{.Name}}\t{{.Digest}}\t{{.Labels}}\n'
result in no output at all.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač 2023-02-23 00:38:38 +01:00
parent d833619740
commit 1c3d49f012

View File

@ -246,5 +246,8 @@ func printTmpl(stdout io.Writer, row string, data []any) error {
return err
}
w := tabwriter.NewWriter(stdout, 8, 2, 2, ' ', 0)
return t.Execute(w, data)
if err := t.Execute(w, data); err != nil {
return err
}
return w.Flush()
}