sync: Replace []error by go.uber.org/multierr
This commit is contained in:
parent
9f49a689fd
commit
b6966d47ce
25 changed files with 380 additions and 348 deletions
|
|
@ -7,10 +7,11 @@ import (
|
|||
"github.com/yuin/goldmark/ast"
|
||||
goldrender "github.com/yuin/goldmark/renderer"
|
||||
"github.com/yuin/goldmark/util"
|
||||
"go.uber.org/multierr"
|
||||
)
|
||||
|
||||
type VoidRenderer struct {
|
||||
errs []error
|
||||
errs error
|
||||
}
|
||||
|
||||
func NewVoidRenderer() *VoidRenderer {
|
||||
|
|
@ -28,7 +29,7 @@ func (r *VoidRenderer) RegisterFuncs(reg goldrender.NodeRendererFuncRegisterer)
|
|||
reg.Register(ast.KindString, r.renderString)
|
||||
}
|
||||
|
||||
func (r *VoidRenderer) Errors() []error {
|
||||
func (r *VoidRenderer) Errors() error {
|
||||
return r.errs
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ func (r *VoidRenderer) renderImage(w util.BufWriter, source []byte, node ast.Nod
|
|||
// Check there is a correct image alt
|
||||
alt := nodeToText(n, source)
|
||||
if len(bytes.Fields(alt)) <= 1 {
|
||||
r.errs = append(r.errs, fmt.Errorf("No valid image alternative defined for %q", n.Destination))
|
||||
r.errs = multierr.Append(r.errs, fmt.Errorf("No valid image alternative defined for %q", n.Destination))
|
||||
return ast.WalkContinue, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue