mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
chore: remove golang.org/x/net/context in favor of stdlib (#47532)
This PR removes golang.org context imports under pkg/services/* and replaces them with the stdlib context. Closes #44178
This commit is contained in:
@@ -11,8 +11,6 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
@@ -52,7 +50,7 @@ func (ns *NotificationService) sendWebRequestSync(ctx context.Context, webhook *
|
||||
return fmt.Errorf("webhook only supports HTTP methods PUT or POST")
|
||||
}
|
||||
|
||||
request, err := http.NewRequest(webhook.HttpMethod, webhook.Url, bytes.NewReader([]byte(webhook.Body)))
|
||||
request, err := http.NewRequestWithContext(ctx, webhook.HttpMethod, webhook.Url, bytes.NewReader([]byte(webhook.Body)))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -72,7 +70,7 @@ func (ns *NotificationService) sendWebRequestSync(ctx context.Context, webhook *
|
||||
request.Header.Set(k, v)
|
||||
}
|
||||
|
||||
resp, err := ctxhttp.Do(ctx, netClient, request)
|
||||
resp, err := netClient.Do(request)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package notifiers
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/encryption"
|
||||
"github.com/grafana/grafana/pkg/services/notifications"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type Manager interface {
|
||||
|
||||
Reference in New Issue
Block a user