Skip to content

Commit

Permalink
fix(go): marshaling tag
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Dec 22, 2023
1 parent ec3e80f commit e2313b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go/marshaling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestMarshal(t *testing.T) {
GGG: []G{{ID: "1", AAA: "ggg"}},
HHH: []*G{{ID: "2", AAA: "hhh"}, nil},
JJJ: &Value{value: "foo"},
KKK: &Tag{ID: "tag"},
KKK: &Tag{Name: "tag"},
}

expected := &Item{
Expand Down
3 changes: 3 additions & 0 deletions go/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func TagsFrom(j any) []Tag {
}

func (t Tag) MarshalCMS() any {
if t.ID == "" {
return t.Name
}
return t.ID
}

Expand Down

0 comments on commit e2313b6

Please sign in to comment.