func PrintTable(columns []*TableColumn) {
	columnWidth := make(map[string]int)
	columnWidthStr := make(map[string]string)
	for _, column := range columns {
		columnWidth[column.Header] = len(column.Header)
		columnWidthStr[column.Header] = strconv.Itoa(len(column.Header))
		for _, cellData := range column.Data {
			if len(cellData) > columnWidth[column.Header] {
				columnWidth[column.Header] = len(cellData)
				columnWidthStr[column.Header] = strconv.Itoa(len(cellData))
			}
		}
	}
	for i, column := range columns {
		formatString := fmt.Sprintf(baseFormatString, columnWidthStr[column.Header])
		if i < (len(columns)) && i > 0 {
			fmt.Print(headerDivider)
		}
		fmt.Printf(formatString, column.Header)
	}
	fmt.Println()
	for i, column := range columns {
		formatString := fmt.Sprintf(baseFormatString, columnWidthStr[column.Header])
		if i < (len(columns)) && i > 0 {
			fmt.Print(dividerDivider)
		}
		fmt.Printf(formatString, strings.Repeat("-", columnWidth[column.Header]))
	}
	fmt.Println()
	for rowIndex := range columns[0].Data {
		for i, column := range columns {
			formatString := fmt.Sprintf(baseFormatString, columnWidthStr[column.Header])
			if i < (len(columns)) && i > 0 {
				fmt.Print(contentDivider)
			}
			fmt.Printf(formatString, column.Data[rowIndex])
		}
		fmt.Println()
	}
}
PrintTable prints a list of TableColumns with auto-sized columns and dividers.
package util
import (
	"fmt"
	"strconv"
	"strings"
)
type TableColumn struct {
	Header string
	Data   []string
}
const baseFormatString = " %%-%ss "
const headerDivider = "   "
const dividerDivider = "-+-"
const contentDivider = " | "