Skip to content
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

encoding/asn1: cannot marshal into slice of strings and pass stringtype parameter tags to members #18834

Open
jcmturner opened this issue Jan 28, 2017 · 2 comments
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@jcmturner
Copy link

What version of Go are you using (go version)?

go version go1.7.5 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build372878858=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1

Issue

I need to be able to marshal into a slice of strings and to be able to specify the string types for the elements in this slice (is5, generalstring, etc)
https://play.golang.org/p/l5id74lMoI
Issue seems to be two fold:

  1. Validation does not allow it and you get the error: explicit string type given to non-string member
  2. Strings would all be marshaled as the default type - PrintableString

Suggestion

When struct tags for string types are defined against a slice this should be accepted if the slice is of strings
The struct tag for the string type should be passed down to the marshaling of the members of the slice

@jcmturner
Copy link
Author

Possible update that appears to work: jcmturner/asn1@d10e504

I note that this problem may also affect slices of time.Time

@bradfitz bradfitz added this to the Unplanned milestone Mar 21, 2017
@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 21, 2017
@btoews
Copy link

btoews commented May 12, 2018

I was complaining about this on the internet and @FiloSottile asked me to open an issue and CC him. It seems there's already an issue though. Here's where I ran into wanting to include a utf8 tag on a []string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

4 participants