refactor(sql): replace multierr with errors.Join
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Peter 2023-02-23 09:39:03 +01:00
parent f87a2fb5b6
commit 7dbb8566b3
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

2
go.mod
View file

@ -14,7 +14,6 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/testcontainers/testcontainers-go v0.17.0
github.com/valyala/bytebufferpool v1.0.0
go.uber.org/multierr v1.9.0
go.uber.org/zap v1.24.0
golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb
golang.org/x/sync v0.1.0
@ -55,6 +54,7 @@ require (
github.com/sirupsen/logrus v1.9.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/net v0.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect

View file

@ -3,8 +3,7 @@ package sql
import (
"context"
"database/sql"
"go.uber.org/multierr"
"errors"
"code.icb4dc0.de/prskr/nurse/check"
"code.icb4dc0.de/prskr/nurse/config"
@ -66,8 +65,10 @@ func (s *SelectCheck) executeAttempt(ctx context.Context) (err error) {
return err
}
defer multierr.AppendInvoke(&err, multierr.Close(rows))
defer multierr.AppendInvoke(&err, multierr.Invoke(rows.Err))
defer func() {
err = errors.Join(rows.Close(), rows.Err())
}()
return s.validators.Validate(rows)
}