Skip to content

Commit 723b3c8

Browse files
Remove MarshalJSON from JSONMetadata
Since Metadata implement json.Marshaler there is no reason to have it for JSONMetadata.
1 parent 9986b95 commit 723b3c8

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

metadata/metadata.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,10 @@ type JSONMetadata struct {
104104
}
105105

106106
var (
107-
// Ensure JSONMetadata implements the json.Marshaler interface
108-
_ json.Marshaler = &JSONMetadata{}
109107
// Ensure JSONMetadata implements the json.Unmarshaler interface
110108
_ json.Unmarshaler = &JSONMetadata{}
111109
)
112110

113-
// MarshalJSON returns a json representation of the wrapped Metadata
114-
func (j JSONMetadata) MarshalJSON() ([]byte, error) {
115-
if j.Metadata == nil {
116-
j.Metadata = New()
117-
}
118-
119-
return json.Marshal(j.Metadata)
120-
}
121-
122111
// UnmarshalJSON unmarshal the json into Metdadata
123112
func (j *JSONMetadata) UnmarshalJSON(data []byte) error {
124113
r := jlexer.Lexer{Data: data}

metadata/metadata_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -212,21 +212,6 @@ func TestMetadata_MarshalJSON(t *testing.T) {
212212
}
213213
}
214214

215-
func TestJSONMetadata_MarshalJSON(t *testing.T) {
216-
for _, testCase := range jsonTestCases {
217-
t.Run(testCase.title, func(t *testing.T) {
218-
m := metadata.JSONMetadata{
219-
Metadata: testCase.metadata(),
220-
}
221-
222-
mJSON, err := json.Marshal(m)
223-
224-
assert.JSONEq(t, testCase.json, string(mJSON))
225-
assert.NoError(t, err)
226-
})
227-
}
228-
}
229-
230215
func TestJSONMetadata_UnmarshalJSON(t *testing.T) {
231216
for _, testCase := range jsonTestCases {
232217
t.Run(testCase.title, func(t *testing.T) {

0 commit comments

Comments
 (0)