Golang HTTP request retry code
I would recommend you to actually strictly match the http.Get signature using a struct:

type Getter func(url string) (*http.Response, error)

type RetryingClient struct {
    Getter Getter
    MaxAttempts int
}

func (rc RetryingClient) Get(url string) (*http.Response, error) {
    ...
}


And instead of directly calling http.Get, the embedded Getter interface gives you much more flexibility:


for testing
for using a proxy




Why do you defer the response.Body.Close() ? Since it won't be use, you can close it immediately.



Using the interface, you could make a function embedded in the struct to compute a default delay instead of hard-coded time.Duration(attempts) * time.Second.
For instance: defaultDelay(attempt int) time.Duration