I feel like this should be a minor problem, but I’ve tried every pattern that I can think of, and I haven’t had any luck. I have a structure that needs to be encodable by both the encoding/json and github.com/zeebo/bencode packages. It happens to include a channel, which cannot be encoded by either package. Thus, it needs to carry the tag "-", so that that field is skipped.
type Index struct {
Data data
Queue chan string `json:"-"`
}
This is valid when encoded by the json package, but fails with the bencode package.
type Index struct {
Data data
Queue chan string `bencode:"-"`
}
This block, of course, has the complimentary problem. I have tried tag syntaxes like json:"-",bencode:"-", *:"-", "-", -. Is there a solution?
Thank you all.
Spaces appear to be the delimiter between struct tags when used for encoding hints.
Example:
From: https://developers.google.com/appengine/docs/go/datastore/reference#Properties
In your case, try: