Go Standard Library Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

The NewWriter function call creates the Writer filter with configured parameters. All data written by this Writer is formatted according to the parameters. os.Stdout is used here for demonstration purposes.

The text/tabwriter package also provides a few more configuration options, such as the flag parameter.  The most useful is tabwriter.AlignRight, which configures the writer to align the content to the right in each column.