Generate ASCII table on the fly ... Installation is simple as
go get github.com/olekukonko/tablewriter
Features
Automatic Padding
Support Multiple Lines
Supports Alignment
Support Custom Separators
Automatic Alignment of numbers & percentage
Write directly to http , file etc via io.Writer
Read directly from CSV file
Optional row line via SetRowLine
Normalise table header
Make CSV Headers optional
Enable or disable table border
Set custom footer support
Optional identical cells merging
Example 1 - Basic
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"})for _, v :=range data { table.Append(v)}table.Render() // Send output
Output 1
+------+-----------------------+--------+
| NAME | SIGN | RATING |
+------+-----------------------+--------+
| A | The Good | 500 |
| B | The Very very Bad Man | 288 |
| C | The Ugly | 120 |
| D | The Gopher | 800 |
+------+-----------------------+--------+
*------------*-----------*---------*
╪ FIRST NAME ╪ LAST NAME ╪ SSN ╪
*------------*-----------*---------*
╪ John ╪ Barry ╪ 123456 ╪
*------------*-----------*---------*
╪ Kathy ╪ Smith ╪ 687987 ╪
*------------*-----------*---------*
╪ Bob ╪ McCornick ╪ 3979870 ╪
*------------*-----------*---------*