Repository navigation
Fix JSON blob test error comparison on Go 1.27 - #756
Merged
Merged
Conversation
checkReadBlob compared the ReadBlob error text against the encoding/json error. Go 1.27 wraps the base64 error in a "json: cannot unmarshal" message, so TestReadBlob and FuzzReadBlob fail on invalid input even though the error and offset match. Compare against the base64.CorruptInputError instead, which is the error ReadBlob wraps.
wty-Bryant
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TestReadBlobandFuzzReadBlob(added in #730) fail on Go 1.27 for every invalid-input case:checkReadBlobexpects theReadBloberror text to be"decode base64 blob: " + <encoding/json error>. On Go 1.27,encoding/jsonputs its own prefix in front of the base64 error:ReadBlobwraps only thebase64.CorruptInputError, so the exact-text comparison no longer holds. The error type and offset checks still pass. CI covers Go 1.24–1.26, so this didn't show up there, but it breaks builds that use Go 1.27.Fix
Compare the error text against the
base64.CorruptInputErrorthe test already extracts, which is the errorReadBlobactually wraps. This holds on every Go version. The test still checks that the error is aCorruptInputErrorat the same offset as the standard library's.Test-only change. No changelog entry.
Testing
go test ./transport/http/protocol/internal/json/passes on Go 1.27.4. It failed before this change.