refactoring: eitherError to firstNonNil
Vladimir Bauer
2 years ago
| 516 | 516 | |
| 517 | 517 | bufP, bufB, bufA := s.buffers[0], s.buffers[1], s.buffers[2] |
| 518 | 518 | |
| 519 | err := eitherError(decorFiller(bufP, s.pDecorators), decorFiller(bufA, s.aDecorators)) | |
| 519 | err := firstNonNil(decorFiller(bufP, s.pDecorators), decorFiller(bufA, s.aDecorators)) | |
| 520 | 520 | if err != nil { |
| 521 | 521 | return nil, err |
| 522 | 522 | } |
| 644 | 644 | return buf.WriteByte(' ') |
| 645 | 645 | } |
| 646 | 646 | |
| 647 | func eitherError(errors ...error) error { | |
| 647 | func firstNonNil(errors ...error) error { | |
| 648 | 648 | for _, err := range errors { |
| 649 | 649 | if err != nil { |
| 650 | 650 | return err |