File tree Expand file tree Collapse file tree 1 file changed +2
-23
lines changed
Expand file tree Collapse file tree 1 file changed +2
-23
lines changed Original file line number Diff line number Diff line change @@ -14,22 +14,7 @@ import (
1414// JSONPb is a Marshaler which marshals/unmarshals into/from JSON
1515// with the "github.com/golang/protobuf/jsonpb".
1616// It supports fully functionality of protobuf unlike JSONBuiltin.
17- type JSONPb struct {
18- // Whether to render enum values as integers, as opposed to string values.
19- EnumsAsInts bool
20-
21- // Whether to render fields with zero values.
22- EmitDefaults bool
23-
24- // A string to indent each level by. The presence of this field will
25- // also cause a space to appear between the field separator and
26- // value, and for newlines to be appear between fields and array
27- // elements.
28- Indent string
29-
30- // Whether to use the original (.proto) name for fields.
31- OrigName bool
32- }
17+ type JSONPb jsonpb.Marshaler
3318
3419// ContentType always returns "application/json".
3520func (* JSONPb ) ContentType () string {
@@ -61,13 +46,7 @@ func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error {
6146 _ , err = w .Write (buf )
6247 return err
6348 }
64- m := & jsonpb.Marshaler {
65- EnumsAsInts : j .EnumsAsInts ,
66- EmitDefaults : j .EmitDefaults ,
67- Indent : j .Indent ,
68- OrigName : j .OrigName ,
69- }
70- return m .Marshal (w , p )
49+ return (* jsonpb .Marshaler )(j ).Marshal (w , p )
7150}
7251
7352// marshalNonProto marshals a non-message field of a protobuf message.
You can’t perform that action at this time.
0 commit comments