aboutsummaryrefslogtreecommitdiff
path: root/object.go
diff options
context:
space:
mode:
authormariusor2022-01-13 16:44:04 +0100
committermariusor2022-01-13 16:44:04 +0100
commit72008812b197a19a6afd2616f8d895a21a3f8ddf (patch)
treeebfd09a5b1c339c57a8575f0337c33225168aaaf /object.go
parentaf0f5aa0eef97e18b3417f92197b4a20bb582d39 (diff)
Simplify the Type gob encode/decode
Diffstat (limited to 'object.go')
-rw-r--r--object.go20
1 files changed, 2 insertions, 18 deletions
diff --git a/object.go b/object.go
index fb045cc..3dc9e04 100644
--- a/object.go
+++ b/object.go
@@ -114,28 +114,12 @@ func (a ActivityVocabularyType) MarshalJSON() ([]byte, error) {
// GobEncode
func (a ActivityVocabularyType) GobEncode() ([]byte, error) {
- if len(a) == 0 {
- return []byte{}, nil
- }
- b := bytes.Buffer{}
- gg := gob.NewEncoder(&b)
- if err := gobEncodeStringLikeType(gg, []byte(a)); err != nil {
- return nil, err
- }
- return b.Bytes(), nil
+ return []byte(a), nil
}
// GobDecode
func (a *ActivityVocabularyType) GobDecode(data []byte) error {
- if len(data) == 0 {
- // NOTE(marius): this behaviour diverges from vanilla gob package
- return nil
- }
- var bb []byte
- if err := gob.NewDecoder(bytes.NewReader(data)).Decode(&bb); err != nil {
- return err
- }
- *a = ActivityVocabularyType(bb)
+ *a = ActivityVocabularyType(data)
return nil
}