Hacker News new | ask | show | jobs
by xxchan 4466 days ago
That definitely helps, though you can't use it to introduce new variables with the := syntax:

if buf, err := json.Marshal(make(chan int)); err != nil { fmt.Println("Ehh..", err) return }

In this case, buf will not be available outside of the if statement. Go fmt can already leave your insignificant whitespace as is, I just wish it could also leave the if error != nil statement say in one line instead of formatting it to take three.