Skip to content

Commit b734c2f

Browse files
committed
tlf: remove MarshalJSON in favor of the existing MarshalText
Suggested by songgao. Issue: 1598
1 parent c0094a3 commit b734c2f

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

tlf/id.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package tlf
77
import (
88
"encoding"
99
"encoding/hex"
10-
"encoding/json"
1110
"fmt"
1211
"strings"
1312

@@ -168,9 +167,6 @@ var _ encoding.BinaryUnmarshaler = (*ID)(nil)
168167
var _ encoding.TextMarshaler = ID{}
169168
var _ encoding.TextUnmarshaler = (*ID)(nil)
170169

171-
var _ json.Marshaler = ID{}
172-
var _ json.Unmarshaler = (*ID)(nil)
173-
174170
// NullID is an empty ID
175171
var NullID = ID{}
176172

@@ -231,21 +227,6 @@ func (id *ID) UnmarshalText(buf []byte) error {
231227
return id.UnmarshalBinary(bytes)
232228
}
233229

234-
// MarshalJSON implements the json.Marshaler interface for ID.
235-
func (id ID) MarshalJSON() ([]byte, error) {
236-
return keybase1.Quote(id.String()), nil
237-
}
238-
239-
// UnmarshalJSON implements the json.Unmarshaler interface for ID.
240-
func (id *ID) UnmarshalJSON(b []byte) error {
241-
newID, err := ParseID(keybase1.Unquote(b))
242-
if err != nil {
243-
return err
244-
}
245-
*id = newID
246-
return nil
247-
}
248-
249230
// SafeType returns the type of TLF represented by this ID. If the ID
250231
// isn't valid, it returns tlf.Unknown along with an error.
251232
func (id ID) SafeType() (Type, error) {

0 commit comments

Comments
 (0)