1
0
mirror of https://github.com/go-task/task.git synced 2025-03-17 21:08:01 +02:00

lint: add linter noctx (#1898)

This commit is contained in:
christiandins 2024-12-12 01:42:04 +01:00 committed by GitHub
parent e1818e9e31
commit b9a5d1c573
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ linters:
- gofmt
- gofumpt
- misspell
- noctx
linters-settings:
depguard:

View File

@ -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}