diff --git a/.golangci.yml b/.golangci.yml index fec3baa882..efbba41dd1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,6 +10,7 @@ linters: - gofmt - gofumpt - misspell + - noctx linters-settings: depguard: diff --git a/taskfile/taskfile.go b/taskfile/taskfile.go index 9e62a0f486..d14b760361 100644 --- a/taskfile/taskfile.go +++ b/taskfile/taskfile.go @@ -43,13 +43,13 @@ var ( // found, an error will be returned. func RemoteExists(ctx context.Context, l *logger.Logger, u *url.URL, timeout time.Duration) (*url.URL, error) { // Create a new HEAD request for the given URL to check if the resource exists - req, err := http.NewRequest("HEAD", u.String(), nil) + req, err := http.NewRequestWithContext(ctx, "HEAD", u.String(), nil) if err != nil { return nil, errors.TaskfileFetchFailedError{URI: u.String()} } // Request the given URL - resp, err := http.DefaultClient.Do(req.WithContext(ctx)) + resp, err := http.DefaultClient.Do(req) if err != nil { if errors.Is(ctx.Err(), context.DeadlineExceeded) { return nil, &errors.TaskfileNetworkTimeoutError{URI: u.String(), Timeout: timeout}