Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <github@ysh.us>

Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
yurishkuro authored Jan 21, 2025
1 parent 909d074 commit c655070
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions model/v1/ids.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ func marshalBytes(dst []byte, src []byte) (n int, err error) {
// Example: {high:2, low:1} => "AAAAAAAAAAIAAAAAAAAAAQ==".
func (t TraceID) MarshalJSON() ([]byte, error) {
var b [16]byte
_, err := t.MarshalTo(b[:]) // can only error on incorrect buffer size
if err != nil {
return nil, err
}
t.MarshalTo(b[:]) // can only error on incorrect buffer size
s := make([]byte, 24+2)
base64.StdEncoding.Encode(s[1:25], b[:])
s[0], s[25] = '"', '"'
Expand Down Expand Up @@ -213,10 +210,7 @@ func (s *SpanID) Unmarshal(data []byte) error {
// Example: {1} => "AAAAAAAAAAE=".
func (s SpanID) MarshalJSON() ([]byte, error) {
var b [8]byte
_, err := s.MarshalTo(b[:]) // can only error on incorrect buffer size
if err != nil {
return nil, err
}
s.MarshalTo(b[:]) // can only error on incorrect buffer size
v := make([]byte, 12+2)
base64.StdEncoding.Encode(v[1:13], b[:])
v[0], v[13] = '"', '"'
Expand Down

0 comments on commit c655070

Please sign in to comment.