orion-server
orion-server copied to clipboard
Method should never return explicit error type (only `error` interface)
Assigning explicit error type (e.g., *ierrors.NotLeaderError
) to an interface variable (e.g. var err error
) will result in nil
check to return false
even if we assign a nil
to it.
See https://go.dev/doc/faq#nil_error and https://go.dev/play/p/8HUKlSDPvCT
The following needs to change in bcdb/db.go
:
DB
type DB interface {
IsLeader() *ierrors.NotLeaderError
}
should be
type DB interface {
IsLeader() error
}
TxProcessor
type TxProcessor interface {
IsLeader() *ierrors.NotLeaderError
}
should be
type TxProcessor interface {
IsLeader() error
}