Skip to content

Commit

Permalink
lint: add linter noctx (#1898)
Browse files Browse the repository at this point in the history
  • Loading branch information
christiandins authored Dec 12, 2024
1 parent e1818e9 commit b9a5d1c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ linters:
- gofmt
- gofumpt
- misspell
- noctx

linters-settings:
depguard:
Expand Down
4 changes: 2 additions & 2 deletions taskfile/taskfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit b9a5d1c

Please sign in to comment.