Skip to content

Fix bytes.Reader issues - #1055

Open
ckbaker10 wants to merge 3 commits into
goss-org:masterfrom
ckbaker10:fix-byte-reader
Open

Fix bytes.Reader issues #1055
ckbaker10 wants to merge 3 commits into
goss-org:masterfrom
ckbaker10:fix-byte-reader

Conversation

@ckbaker10

Copy link
Copy Markdown
Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (if applicable)
  • documentation is changed or added (if applicable)

Description of change

file resource contents checks always reported object: *bytes.Reader on failure instead of the actual file content, making it completely useless for debugging.

Root cause: in ValidateGomegaValue, the func() (io.Reader, error) switch arm called f() and passed the raw io.Reader as foundValue to HavePatterns. The matcher scanned it fine, but once consumed, FailureResult had nothing left to read and fell through to fmt.Sprintf("object: %T", actual).

Fix: materialize the reader into a string immediately in the switch arm before handing it to the matcher. HavePatterns already handles string input, and FailureResult already formats strings correctly — so no changes needed there.

Updated three golden test fixtures that were asserting the broken "object: *strings.Reader" output.

@kgaughan

kgaughan commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

I'm hoping I can get this merged in a subsequent release. It's borderline between a bugfix and a behavioural change, but it's definitely worth fixing, if only because I hit this issue when fixing other bugs.

In the meantime, would you mind merging from master?

@kgaughan

kgaughan commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

@ckbaker10 Now that 0.4.10 is out and everything's been fixed up, I'd be very interested in getting this merged. The same goes for #1057. However, owing to the vintage of the two PRs, I need you to do a merge from master to pick up the updated integration test pipelines, &c. This way, I can kick them off to make sure everything's good.

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