That Go code on this page [0] isn't particularly idomatic (or even functional), consider something like this [1] perhaps.
You can insert a `defer log.Println(err)` if you want to handle that particular error but I didn't bother.
log.Println(err) would be better than returning err, because returning err makes people wrongly think the error is being handled somewhere, when in reality nothing is looking at the return value. Using defer for that seems a bit strange though.