浏览代码

Config: Correctly marshal `Address` to JSON (#4021)

yiguous 11 月之前
父节点
当前提交
55e045d098
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      infra/conf/common.go

+ 4 - 0
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 {