You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcmain() {
data:= [][]string{
[]string{"A", "The Good", "500"},
[]string{"B", "The Very very Bad Man", "288"},
[]string{"C", "The Ugly", "120"},
[]string{"D", "The Gopher", "800"},
}
table:=tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Name", "Sign", "Rating"})
table.SetFooter([]string{"Name", "Sign"})
for_, v:=rangedata {
table.Append(v)
}
table.Render() // Send output
}
go run output:
+------+-----------------------+--------+
| NAME | SIGN | RATING |
+------+-----------------------+--------+
| A | The Good | 500 || B | The Very very Bad Man | 288 || C | The Ugly | 120 || D | The Gopher | 800 |
+------+-----------------------+--------+
| NAME | SIGN |panic: runtime error: index out of range [2] with length 2
goroutine 1 [running]:
github.com/olekukonko/tablewriter.(*Table).printFooter(0xc000130000)
/opt/workspace/pkg/mod/github.com/olekukonko/[email protected]/table.go:563 +0xa8a
github.com/olekukonko/tablewriter.(*Table).Render(0xc000130000)
/opt/workspace/pkg/mod/github.com/olekukonko/[email protected]/table.go:138 +0xeb
main.main()
...
The text was updated successfully, but these errors were encountered:
code
go run output:
The text was updated successfully, but these errors were encountered: