Replace golang.org/x/net/context with std library

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
This commit is contained in:
Shengjing Zhu
2022-02-22 02:15:03 +08:00
parent d128c3767b
commit f4f41296c2
62 changed files with 68 additions and 71 deletions

View File

@@ -36,7 +36,6 @@ import (
digest "github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
"golang.org/x/net/context/ctxhttp"
)
var (
@@ -524,7 +523,7 @@ type request struct {
func (r *request) do(ctx context.Context) (*http.Response, error) {
u := r.host.Scheme + "://" + r.host.Host + r.path
req, err := http.NewRequest(r.method, u, nil)
req, err := http.NewRequestWithContext(ctx, r.method, u, nil)
if err != nil {
return nil, err
}
@@ -566,7 +565,7 @@ func (r *request) do(ctx context.Context) (*http.Response, error) {
}
}
resp, err := ctxhttp.Do(ctx, client, req)
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("failed to do request: %w", err)
}