Merge pull request #90 from strukturag/remove-golang-x-net-context

Remove unnecessary dependency golang.org/x/net
This commit is contained in:
Joachim Bauch 2021-04-13 16:39:30 +02:00 committed by GitHub
commit 2c126354a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View file

@ -36,7 +36,6 @@ import (
"sync" "sync"
"github.com/dlintw/goconf" "github.com/dlintw/goconf"
"golang.org/x/net/context/ctxhttp"
) )
var ( var (
@ -248,8 +247,14 @@ func performRequestWithRedirects(ctx context.Context, client *http.Client, req *
req.Body = ioutil.NopCloser(bytes.NewReader(body)) req.Body = ioutil.NopCloser(bytes.NewReader(body))
req.ContentLength = int64(len(body)) req.ContentLength = int64(len(body))
} }
resp, err = ctxhttp.Do(ctx, client, req) resp, err = client.Do(req.WithContext(ctx))
if err != nil { if err != nil {
// Prefer context error if it has been cancelled.
select {
case <-ctx.Done():
err = ctx.Err()
default:
}
if e, ok := err.(*url.Error); !ok || resp == nil || e.Err != ErrUseLastResponse { if e, ok := err.(*url.Error); !ok || resp == nil || e.Err != ErrUseLastResponse {
return nil, err return nil, err
} }

1
go.mod
View file

@ -16,6 +16,5 @@ require (
github.com/notedit/janus-go v0.0.0-20200517101215-10eb8b95d1a0 github.com/notedit/janus-go v0.0.0-20200517101215-10eb8b95d1a0
github.com/oschwald/maxminddb-golang v1.3.1-0.20190523235738-1960b16a5147 github.com/oschwald/maxminddb-golang v1.3.1-0.20190523235738-1960b16a5147
go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
gopkg.in/dgrijalva/jwt-go.v3 v3.2.0 gopkg.in/dgrijalva/jwt-go.v3 v3.2.0
) )

View file

@ -22,10 +22,9 @@
package signaling package signaling
import ( import (
"context"
"encoding/json" "encoding/json"
"testing" "testing"
"golang.org/x/net/context"
) )
func TestVirtualSession(t *testing.T) { func TestVirtualSession(t *testing.T) {