In Go error type is a built-in interface with a single method Error() string.

All rules governing interfaces apply to error type.

Among others, any type that implements error interface can be used as value of error type.

https://codeeval.dev/gist/05256b6d9a98579b1ca37941284934f9

Why use custom type in addition to built-in ways of creating errors?

Potential use cases are: