Skip to content

Commit

Permalink
noctx enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Dec 31, 2023
1 parent 321be1b commit d8e7a31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ linters:
- nakedret
- nilerr
- nlreturn
- noctx
- nonamedreturns
- nosnakecase
- paralleltest
Expand Down
6 changes: 3 additions & 3 deletions examples/serverless/healthcheck/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ func (s *service) createTableIfNotExists(ctx context.Context) error {
)
}

func (s *service) ping(path string) (code int32, err error) {
func (s *service) ping(ctx context.Context, path string) (code int32, err error) {
uri, err := url.Parse(path)
if err != nil {
return -1, err
}
if uri.Scheme == "" {
uri.Scheme = "http"
}
request, err := http.NewRequest(http.MethodGet, uri.String(), nil) //nolint:gocritic
request, err := http.NewRequestWithContext(ctx, http.MethodGet, uri.String(), nil) //nolint:gocritic
if err != nil {
return -1, err
}
Expand Down Expand Up @@ -130,7 +130,7 @@ func (s *service) check(ctx context.Context, urls []string) error {
go func(idx int, u string) {
defer wg.Done()
out := " > '" + u + "' => "
code, err := s.ping(u)
code, err := s.ping(ctx, u)
if err != nil {
fmt.Println(out + err.Error())
} else {
Expand Down

0 comments on commit d8e7a31

Please sign in to comment.