Explorar o código

etcdhttp: implment Peers.String()

Xiang Li %!s(int64=11) %!d(string=hai) anos
pai
achega
378cadf073
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      etcdserver/etcdhttp/http.go

+ 7 - 1
etcdserver/etcdhttp/http.go

@@ -57,7 +57,13 @@ func (ps *Peers) Set(s string) error {
 }
 
 func (ps *Peers) String() string {
-	return "todo"
+	v := url.Values{}
+	for k, vv := range *ps {
+		for i := range vv {
+			v.Add(strconv.FormatInt(k, 16), vv[i])
+		}
+	}
+	return v.Encode()
 }
 
 func (ps Peers) Ids() []int64 {