Skip to content

Commit

Permalink
refactoring: eitherError to firstNonNil
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Mar 23, 2024
1 parent 772b760 commit 2aaf6ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bar.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ func (s *bState) drawImpl(stat decor.Statistics) (io.Reader, error) {

bufP, bufB, bufA := s.buffers[0], s.buffers[1], s.buffers[2]

err := eitherError(decorFiller(bufP, s.pDecorators), decorFiller(bufA, s.aDecorators))
err := firstNonNil(decorFiller(bufP, s.pDecorators), decorFiller(bufA, s.aDecorators))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -645,7 +645,7 @@ func writeSpace(buf *bytes.Buffer) error {
return buf.WriteByte(' ')
}

func eitherError(errors ...error) error {
func firstNonNil(errors ...error) error {
for _, err := range errors {
if err != nil {
return err
Expand Down

0 comments on commit 2aaf6ca

Please sign in to comment.