Implement MarshalJSON and UnmarshalJSON for tag.T, update relayinfo marshaling comments, and adjust tests for consistent JSON handling.

This commit is contained in:
2025-08-23 02:26:47 +01:00
parent ddb4c486cb
commit 0f7f3017ea
3 changed files with 21 additions and 2 deletions

View File

@@ -291,6 +291,8 @@ func NewInfo(inf *T) (info *T) {
func (ri *T) Clone() (r2 *T, err error) {
r2 = new(T)
var b []byte
// beware, this will escape <, > and & to unicode escapes but that should be
// ok since this data is not signed in events until after it is marshaled.
if b, err = json.Marshal(ri); chk.E(err) {
return
}
@@ -330,6 +332,8 @@ func (ri *T) Save(filename string) (err error) {
return
}
var b []byte
// beware, this will escape <, > and & to unicode escapes but that should be
// ok since this data is not signed in events until after it is marshaled.
if b, err = json.MarshalIndent(ri, "", " "); chk.E(err) {
return
}