Golang go/printer.Config type examples

package go/printer

A Config node controls the output of Fprint.

Golang go/printer.Config type usage example

Example 1:

 var opt *Options
 ...
 printerMode := printer.UseSpaces
 if opt.TabIndent {
 printerMode |= printer.TabIndent
 }
 printConfig := &printer.Config{Mode: printerMode, Tabwidth: opt.TabWidth}

Example 2:

 var config = &printer.Config{Mode: printer.UseSpaces | printer.TabIndent, Tabwidth: 8}

Reference :

http://golang.org/pkg/go/printer/#Config

Advertisement