From dc761f5f50783f46accc06a874f62ef67b6a791e Mon Sep 17 00:00:00 2001 From: showwin Date: Sun, 20 Feb 2022 11:15:34 +0900 Subject: [PATCH] fix conflict from #62 and #63 --- speedtest/server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/speedtest/server.go b/speedtest/server.go index ca9edc9..e53ed5b 100644 --- a/speedtest/server.go +++ b/speedtest/server.go @@ -23,7 +23,6 @@ const ( XMLPayload ) - // Server information type Server struct { URL string `xml:"url,attr" json:"url"` @@ -76,7 +75,7 @@ func (client *Speedtest) FetchServers(user *User) (Servers, error) { return client.FetchServerListContext(context.Background(), user) } -// FetchServerList retrieves a list of available servers +// FetchServers retrieves a list of available servers func FetchServers(user *User) (Servers, error) { return defaultClient.FetchServers(user) } @@ -131,13 +130,14 @@ func (client *Speedtest) FetchServerListContext(ctx context.Context, user *User) if err := decoder.Decode(&list); err != nil { return servers, err } + servers = list.Servers default: return servers, fmt.Errorf("response payload decoding not implemented") } // set doer of server - for _, s := range list.Servers { + for _, s := range servers { s.doer = client.doer } @@ -161,7 +161,7 @@ func (client *Speedtest) FetchServerListContext(ctx context.Context, user *User) } // FetchServerListContext retrieves a list of available servers, observing the given context. -func FetchServerListContext(ctx context.Context, user *User) (ServerList, error) { +func FetchServerListContext(ctx context.Context, user *User) (Servers, error) { return defaultClient.FetchServerListContext(ctx, user) }