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:
parent
e1818e9e31
commit
b9a5d1c573
@ -10,6 +10,7 @@ linters:
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- misspell
|
||||
- noctx
|
||||
|
||||
linters-settings:
|
||||
depguard:
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user