Richard Bucker

Sample prettyprint code in blogger

Posted at — Nov 3, 2014

Thanks to Heiner’s post I think I can prettyprint code. The code below is from a previous post but meant for testing purposes.


package main
import (
“fmt”
)
type myfactory struct{}
func (f *myfactory) make(line string) task {
return &work{line: line}
}
type work struct {
line string
}
func (w *work) process() {
w.line = strings.ToUpper(w.line)
}
func (w *work) print() {
fmt.Println(w.line)
}