To be fair, removing the assignment altogether in your example ignores the error much less explicitly than `try { myFunc(); } except { pass; }`
If you remove the err assignment the compiler will also complain about a value assignment mismatch:
https://play.golang.org/p/UBL0MZtscc
> tmp/sandbox307381845/main.go:8: multiple-value "html/template".New("foo").Parse() in single-value context
You would have to explicitly assign the err return value to underscore in order to ignore it.
hueving is correct, I meant something like this[1]. Of course, something like this[2] also works.
That function does not have side effects, so it would be pointless to remove the assignment altogether.
Assigning errors to underscore is effectively the same as try { myFunc(); } except { pass; }, making them equivalent.
> tmp/sandbox459432416/main.go:10: err declared and not used
Go won't compile unless you handle your errors.