The io package declares an EOF error like this:
var EOF = errors.New("EOF")
using this pattern to raise custom errors leads to ugly stack traces since the errors are generated during intialization, not when they happen:
github.com/andig/gosml.init
/Users/andig/Documents/htdocs/go/src/github.com/andig/gosml/crc16.go:32
main.init
<autogenerated>:1
runtime.main
/usr/local/opt/go/libexec/src/runtime/proc.go:186
runtime.goexit
/usr/local/opt/go/libexec/src/runtime/asm_amd64.s:2361
in fact, the entire call stack of where is error happens is lost which means using the error type is impossible.
How could one implement custom error types or errors the can be behaviour-checked according to your blog article?
The io package declares an EOF error like this:
using this pattern to raise custom errors leads to ugly stack traces since the errors are generated during intialization, not when they happen:
in fact, the entire call stack of where is error happens is lost which means using the error type is impossible.
How could one implement custom error types or errors the can be behaviour-checked according to your blog article?