diff options
| author | Mateusz Poliwczak <mpoliwczak34@gmail.com> | 2024-05-15 17:36:53 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-05-16 02:00:26 +0000 |
| commit | 722d59436bc5881914619d2b95c9d01a46036428 (patch) | |
| tree | 5fd124e2cd508a4c5f7c30a9a72d7b2363cc4820 /src/encoding | |
| parent | 8ce2fedaeb1b4e5c61a811223dd07fc1dff6b81f (diff) | |
| download | go-722d59436bc5881914619d2b95c9d01a46036428.tar.xz | |
crypto/x509: add text and binary marshal methods to OID
Fixes #66249
Change-Id: I5973a19a087a35ad951e8a220d3e6e4456c7577f
GitHub-Last-Rev: 921ca8bd0c08687bb727dbfb0890c3355eebe95b
GitHub-Pull-Request: golang/go#66599
Reviewed-on: https://go-review.googlesource.com/c/go/+/575295
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Diffstat (limited to 'src/encoding')
| -rw-r--r-- | src/encoding/gob/encode.go | 2 | ||||
| -rw-r--r-- | src/encoding/gob/type.go | 14 |
2 files changed, 3 insertions, 13 deletions
diff --git a/src/encoding/gob/encode.go b/src/encoding/gob/encode.go index c83071c717..5f4d2539fa 100644 --- a/src/encoding/gob/encode.go +++ b/src/encoding/gob/encode.go @@ -601,7 +601,7 @@ func compileEnc(ut *userTypeInfo, building map[*typeInfo]bool) *encEngine { if ut.externalEnc == 0 && srt.Kind() == reflect.Struct { for fieldNum, wireFieldNum := 0, 0; fieldNum < srt.NumField(); fieldNum++ { f := srt.Field(fieldNum) - if !isSent(srt, &f) { + if !isSent(&f) { continue } op, indir := encOpFor(f.Type, seen, building) diff --git a/src/encoding/gob/type.go b/src/encoding/gob/type.go index 3b1dde492c..c3ac1dbd61 100644 --- a/src/encoding/gob/type.go +++ b/src/encoding/gob/type.go @@ -538,7 +538,7 @@ func newTypeObject(name string, ut *userTypeInfo, rt reflect.Type) (gobType, err idToTypeSlice[st.id()] = st for i := 0; i < t.NumField(); i++ { f := t.Field(i) - if !isSent(t, &f) { + if !isSent(&f) { continue } typ := userType(f.Type).base @@ -576,7 +576,7 @@ func isExported(name string) bool { // isSent reports whether this struct field is to be transmitted. // It will be transmitted only if it is exported and not a chan or func field // or pointer to chan or func. -func isSent(struct_ reflect.Type, field *reflect.StructField) bool { +func isSent(field *reflect.StructField) bool { if !isExported(field.Name) { return false } @@ -590,16 +590,6 @@ func isSent(struct_ reflect.Type, field *reflect.StructField) bool { return false } - // Special case for Go 1.22: the x509.Certificate.Policies - // field is unencodable but also unused by default. - // Ignore it, so that x509.Certificate continues to be encodeable. - // Go 1.23 will add the right methods so that gob can - // handle the Policies field, and then we can remove this check. - // See go.dev/issue/65633. - if field.Name == "Policies" && struct_.PkgPath() == "crypto/x509" && struct_.Name() == "Certificate" { - return false - } - return true } |
