Ver Fonte

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

yiguous há 11 meses atrás
pai
commit
55e045d098
1 ficheiros alterados com 4 adições e 0 exclusões
  1. 4 0
      infra/conf/common.go

+ 4 - 0
infra/conf/common.go

@@ -42,6 +42,10 @@ type Address struct {
 	net.Address
 	net.Address
 }
 }
 
 
+func (v Address) MarshalJSON() ([]byte, error) {
+	return json.Marshal(v.Address.String())
+}
+
 func (v *Address) UnmarshalJSON(data []byte) error {
 func (v *Address) UnmarshalJSON(data []byte) error {
 	var rawStr string
 	var rawStr string
 	if err := json.Unmarshal(data, &rawStr); err != nil {
 	if err := json.Unmarshal(data, &rawStr); err != nil {