Better HN
topnewbestaskshowjobs
Log inSign up

codo2

20 karma · joined Jul 15, 2015 (11y ago) · 2 submissions

Submissions

comment 11y ago · link · parent

It's not a critique but a suggestion. Like you are saying, it is not an error, my suggestion is simply to follow the standard library.

From golang.org Effective Go: "In the Go libraries, you'll find that when an if statement doesn't flow into the next statement—that is, the body ends in break, continue, goto, or return—the unnecessary else is omitted."

comment 11y ago · link · parent

To make the code simpler to read, I would suggest removing a bunch of "else {", like the ones on lines 84, 112 and 119 of main.go. When you have something like:

if err != nil { return err }

you don't need to put a else after the closing }.