Files
Sylvain RabotandGitHub ceabd4cd1a refactor: replace github.com/pkg/errors with stdlib errors (#661)
Migrate all internal usages of github.com/pkg/errors to the Go standard
library: errors.New/Is/As map directly to the stdlib equivalents, while
errors.Wrap/Wrapf become fmt.Errorf(..., %w, err). github.com/pkg/errors
is no longer a direct dependency (remains indirect via watermill).

Constraint: errors.Wrap returns nil on nil input; fmt.Errorf does not, so
run.go's "executing migration" wrap was rewritten as an explicit nil check
Confidence: high
Scope-risk: narrow
2026-07-07 09:11:30 +00:00

26 lines
457 B
Go

package logging
import (
"bufio"
"errors"
"io"
)
func StreamReader(logger Logger, r io.Reader, fn func(Logger, ...any)) {
br := bufio.NewReader(r)
for {
// todo: handle isPrefix for lines bigger than 65 characters
line, _, err := br.ReadLine()
if err != nil {
switch {
case errors.Is(err, io.EOF):
return
default:
logger.Errorf("error reading container logs buffer: %s", err)
}
return
}
fn(logger, string(line))
}
}