From 3eb9f875ab24e6d5df0178105ea02d32427d6fc5 Mon Sep 17 00:00:00 2001 From: Marko Kungla Date: Tue, 15 Mar 2022 21:58:11 +0200 Subject: [PATCH] doc: update readme example Signed-off-by: Marko Kungla --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a88c4f2..ff69f23 100644 --- a/README.md +++ b/README.md @@ -157,9 +157,10 @@ func main() { wg.Add(1) go func(ctx context.Context, host string) { defer wg.Done() - // switching host. all options changes are safe to call from goroutines. - koios.Host(host)(api) - res, _ := api.GET(ctx, "/tip", nil, nil) + // switching host by creating light clone of client + // with new options + client, err := api.WithOptions(koios.Host(host)) + res, _ := client.GET(ctx, "/tip", nil, nil) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println("Host: ", host) @@ -168,7 +169,6 @@ func main() { } wg.Wait() - fmt.Println("requests done: ", api.TotalRequests()) } ```