Skip to content

Conversation

@emersion
Copy link
Contributor

@emersion emersion commented Feb 3, 2026

err might be nil here. Calling Error on nil will panic.

err might be nil here. Calling Error on nil will panic.
t.Run(tt.desc, func(t *testing.T) {
if _, err := Read(tt.reader); err != tt.expectedError {
t.Fatalf("expected %s, actual %s", tt.expectedError, err.Error())
t.Fatalf("expected %v, actual %v", tt.expectedError, err)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you use a linter for finding this one or what?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this while working on #144. I temporarily removed this Peek call and ended up hitting the panic:

if _, err := reader.Peek(int(length)); err != nil {

@pires pires merged commit dbff835 into pires:main Feb 4, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants