-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go 1.19: request body is not seekable
error
#276
Comments
@barrettj12 Yeah, this is a tricky one. We could fix this library so it handles the new case: either by testing against a type that is I wonder if the better fix is to read the request body into a |
Then we would have to implement Read, Seek, Close on the []byte right? |
No, you can just wrap it in a req.Body = io.NopCloser(bytes.NewReader(body)) |
Hmm, but then we're wrapping the bytes in a Reader, unwrapping, then wrapping again. Feels kinda pointless. Looking at the io source code, it seems |
It might be "pointless", but it's also very cheap (a However, I'm not opposed to the |
#14498 ## Changes - update Go version to 1.19 in go.mod - Set GOROOT before linting to fix golangci/golangci-lint#3107 - update go-macaroon-bakery to fix go-macaroon-bakery/macaroon-bakery#276 - Run Go 1.19's `go fmt` over everything (there have been some changes in 1.19) - Rebuild facade schema to catch minor formatting change. Most of the changes are minor formatting tweaks from gofmt. Go 1.18's `gofmt` still passes. ## QA steps Wait for CI to pass.
This works fine on Go <= 1.18, but on Go 1.19, it is failing with the error
Looking into the code, it seems the issue is with the function
httpbakery/request.go:seekerFromBody
. In the Go 1.19 release notes:So the check here is not quite correct - we need to compare it against the type of
io.nopCloserWriterTo
.I wonder if there's actually a more robust way to do this.
The text was updated successfully, but these errors were encountered: