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
crypto/tls: ConnectionState struct can not be json encoded in 1.11rc1 #27125
Comments
Yeah, let's add that json struct tag to that one field only in master & cherry-pick it to Go 1.11. In the same CL, fix the typo in the documentation. The doc says "ExportKeyMaterial" but the field is named "ExportKeyingMaterial". |
Actually the |
Could we unexport that field instead and add a method that used the unexported field? Then we're back to having no func types in that previously-data-only struct. And then we don't have to add JSON stuff, and we don't need to worry about XML or protobuf, etc. |
Change https://golang.org/cl/130535 mentions this issue: |
Yeah, I don't see any rationale in https://go-review.googlesource.com/c/go/+/85115, so I tend to agree. Does adding an unexported field to a struct that previously had none cause issues? |
@FiloSottile, adding an unexported field to a struct without them isn't something we do lightly. (going from fully public to partially private is a big step) But in this case I think it's better. The other big thing we consider is breaking comparability (notably going from being able to use types as map keys to not being able to). But we already have slices in this, so that's already out the window. I see no problems with a hidden field here, and I think a method would be better API anyway. |
The unexported field is hidden from reflect based marshalers, which would break otherwise. Also, make it return an error, as there are multiple reasons it might fail. Fixes golang#27125 Change-Id: I92adade2fe456103d2d5c0315629ca0256953764 Reviewed-on: https://go-review.googlesource.com/130535 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The unexported field is hidden from reflect based marshalers, which would break otherwise. Also, make it return an error, as there are multiple reasons it might fail. Fixes golang#27125 Change-Id: I92adade2fe456103d2d5c0315629ca0256953764 Reviewed-on: https://go-review.googlesource.com/130535 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
What version of Go are you using (
go version
)?go1.11rc1
Does this issue reproduce with the latest release?
go1.11rc1 - yes
go1.10.3 - no
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
Prints
json: unsupported type: func(string, []uint8, int) ([]uint8, bool)
What did you expect to see?
in go1.10.3 nothing is printed
The text was updated successfully, but these errors were encountered: