Skip to content

Fix bytes.Reader issues #1055

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

Fix bytes.Reader issues #1055
ckbaker10 wants to merge 3 commits intogoss-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.

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.

1 participant