Skip to content

Commit

Permalink
paging-util: remove inner func
Browse files Browse the repository at this point in the history
  • Loading branch information
aviau committed Sep 15, 2024
1 parent 9c29ca1 commit 4d0cedb
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions examples/paging-util/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}

}

0 comments on commit 4d0cedb

Please sign in to comment.