Initial work marking communications
And a bunch of lint fixes
This commit is contained in:
parent
67c99436d1
commit
3153e8bf13
36 changed files with 1958 additions and 487 deletions
25
lint/error.go
Normal file
25
lint/error.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package lint
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type Errorable = func() error
|
||||
|
||||
func LogOnErr(f Errorable, msg string) {
|
||||
e := f()
|
||||
if e != nil {
|
||||
log.Error().Err(e).Msg(msg)
|
||||
}
|
||||
}
|
||||
|
||||
type ErrorableCtx = func(context.Context) error
|
||||
|
||||
func LogOnErrCtx(f ErrorableCtx, ctx context.Context, msg string) {
|
||||
e := f(ctx)
|
||||
if e != nil {
|
||||
log.Error().Err(e).Msg(msg)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue