[bug] A long string causes the table to render extra rows
27149chen opened this issue · comments
Guang Jiong Lou commented
code:
data := [][]string{
{"1/1/2014", "Domain name", "2233", "$10.98"},
{"1/1/2014", "January Hosting", "2233", "$54.95"},
{"1/4/2014", "February Hosting a very very long message", "2233", "$51.00"},
{"1/4/2014", "February Extra Bandwidth", "2233", "$30.00"},
}
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Date", "Description", "CV2", "Amount"})
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
table.SetAlignment(tablewriter.ALIGN_LEFT)
table.AppendBulk(data)
table.Render()
result:
DATE | DESCRIPTION | CV2 | AMOUNT |
---|---|---|---|
1/1/2014 | Domain name | 2233 | $10.98 |
1/1/2014 | January Hosting | 2233 | $54.95 |
1/4/2014 | February Hosting a very very | 2233 | $51.00 |
long message | |||
1/4/2014 | February Extra Bandwidth | 2233 | $30.00 |