From 55e045d0982c01d78b0c5beb2ac747ca847f8d05 Mon Sep 17 00:00:00 2001 From: yiguous <147401898+yiguous@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:18:47 +0800 Subject: [PATCH] Config: Correctly marshal `Address` to JSON (#4021) --- infra/conf/common.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/infra/conf/common.go b/infra/conf/common.go index ccd36d3d..fd6e732a 100644 --- a/infra/conf/common.go +++ b/infra/conf/common.go @@ -42,6 +42,10 @@ type Address struct { net.Address } +func (v Address) MarshalJSON() ([]byte, error) { + return json.Marshal(v.Address.String()) +} + func (v *Address) UnmarshalJSON(data []byte) error { var rawStr string if err := json.Unmarshal(data, &rawStr); err != nil {