From 4d0cedb422611816c51b70419ad4eb147676bdd5 Mon Sep 17 00:00:00 2001 From: aviau Date: Sun, 15 Sep 2024 12:54:34 -0400 Subject: [PATCH] paging-util: remove inner func --- examples/paging-util/main.go | 38 +++++++++++++++++------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/examples/paging-util/main.go b/examples/paging-util/main.go index 08de8c1..e1aad3e 100644 --- a/examples/paging-util/main.go +++ b/examples/paging-util/main.go @@ -20,26 +20,24 @@ func main() { for result, err := range client.IterGet( "/leaksdb/v2/sources", nil, ) { - func(result *flareio.IterResult, err error) { - // Rate Limiting - time.Sleep(time.Second * 1) - - if err != nil { - fmt.Printf("unexpected error: %s\n", err) - os.Exit(1) - } - - // Handle the response... - defer result.Response.Body.Close() - - // Print the status - fetchedPages = fetchedPages + 1 - fmt.Printf( - "Fetched %d page(s) of LeaksDB Sources, next=%s\n", - fetchedPages, - result.Next, - ) - }(result, err) + // Rate Limiting + time.Sleep(time.Second * 1) + + if err != nil { + fmt.Printf("unexpected error: %s\n", err) + os.Exit(1) + } + + // Handle the response... + result.Response.Body.Close() + + // Print the status + fetchedPages = fetchedPages + 1 + fmt.Printf( + "Fetched %d page(s) of LeaksDB Sources, next=%s\n", + fetchedPages, + result.Next, + ) } }