Skip to content

yurishkuro/gogoproto-custom-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo illustrates the issue reported here: gogo/protobuf#411

Specifically, message Span contains two fields TraceID and SpanID defined as bytes. They are both backed by custom types TraceID and SpanID, where TraceID is a two-field struct and SpanID is an alias to uint64.

The test ids_test.go does round-trip serialization using proto buffers and JSON. If the method func (s *SpanID) UnmarshalJSONPB at the end of ids.go is commented out or removed, the test fails, even though SpanID implements func (t *T) UnmarshalJSON(data []byte) error {} required for custom types per https://github.com/gogo/protobuf/blob/master/custom_types.md.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published