Skip to content

Commit aa38c72

Browse files
remyleoneMonitob
andauthored
chore: fix contextcheck linter (#1286)
Co-authored-by: jaime Bernabe <[email protected]>
1 parent fae2a38 commit aa38c72

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ linters:
77
- bidichk # Checks for dangerous unicode character sequences [fast: true, auto-fix: false]
88
- bodyclose # checks whether HTTP response body is closed successfully [fast: false, auto-fix: false]
99
- containedctx # containedctx is a linter that detects struct contained context.Context field [fast: true, auto-fix: false]
10+
- contextcheck # check the function whether use a non-inherited context [fast: false, auto-fix: false]
1011
- deadcode # Finds unused code [fast: false, auto-fix: false]
1112
- decorder # check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
1213
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
@@ -61,7 +62,6 @@ linters:
6162
- whitespace # Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]
6263

6364
disable:
64-
- contextcheck # check the function whether use a non-inherited context [fast: false, auto-fix: false]
6565
- cyclop # checks function and package cyclomatic complexity [fast: false, auto-fix: false]
6666
- dupl # Tool for code clone detection [fast: true, auto-fix: false]
6767
- errorlint # errorlint is a linter for that can be used to find code that will cause problems with the error wrapping scheme introduced in Go 1.13. [fast: false, auto-fix: false]

scaleway/resource_rdb_database.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func resourceScalewayRdbDatabaseCreate(ctx context.Context, d *schema.ResourceDa
9797

9898
var db *rdb.Database
9999
// wrapper around StateChangeConf that will just retry the database creation
100-
err = resource.RetryContext(context.Background(), createDatabaseTimeout, func() *resource.RetryError {
100+
err = resource.RetryContext(ctx, createDatabaseTimeout, func() *resource.RetryError {
101101
currentDB, errCreateDB := rdbAPI.CreateDatabase(createReq, scw.WithContext(ctx))
102102
if errCreateDB != nil {
103103
// WIP: Issue on creation/write database. Need a database stable status

scaleway/retryable_transport.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ func newRetryableTransport(defaultTransport http.RoundTripper) http.RoundTripper
2121
c.RetryWaitMax = 2 * time.Minute
2222
c.Logger = l
2323
c.RetryWaitMin = time.Second * 2
24-
c.CheckRetry = func(_ context.Context, resp *http.Response, err error) (bool, error) {
24+
c.CheckRetry = func(ctx context.Context, resp *http.Response, err error) (bool, error) {
2525
if resp == nil || resp.StatusCode == http.StatusTooManyRequests {
2626
return true, err
2727
}
28-
return retryablehttp.DefaultRetryPolicy(context.TODO(), resp, err)
28+
return retryablehttp.DefaultRetryPolicy(ctx, resp, err)
2929
}
3030

3131
return &retryableTransport{c}

0 commit comments

Comments
 (0)