Skip to content

Commit

Permalink
https://github.com/golang/go/issues/18834
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmturner committed Jan 28, 2017
1 parent 7ff1ef5 commit d10e504
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
This is a temporary repository that will be removed when the issues below are fixed in the core golang code.

## Issues
* [encoding/asn1: cannot marshal into a GeneralString](https://github.com/golang/go/issues/18832)
* [encoding/asn1: cannot marshal into a GeneralString](https://github.com/golang/go/issues/18832)
* [encoding/asn1: cannot marshal into slice of strings and pass stringtype parameter tags to members](https://github.com/golang/go/issues/18834)
8 changes: 6 additions & 2 deletions marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,11 @@ func makeBody(value reflect.Value, params fieldParameters) (e encoder, err error
default:
m := make([]encoder, l)

// Pass on the tags to the members but need to unset explicit switch and implicit value
params.explicit = false
params.tag = nil
for i := 0; i < l; i++ {
m[i], err = makeField(v.Index(i), fp)
m[i], err = makeField(v.Index(i), params)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -569,7 +572,8 @@ func makeField(v reflect.Value, params fieldParameters) (e encoder, err error) {
return nil, StructuralError{"explicit time type given to non-time member"}
}

if params.stringType != 0 && tag != TagPrintableString {
// Updated to accept a slice of strings
if params.stringType != 0 && !(tag == TagPrintableString || (v.Kind() == reflect.Slice && tag == 16 && v.Type().Elem().Kind() == reflect.String)){
return nil, StructuralError{"explicit string type given to non-string member"}
}

Expand Down

0 comments on commit d10e504

Please sign in to comment.