瀏覽代碼

acme, acme/autocert: switch to Go 1.7+ context package

The standard library context package has been available since Go 1.7,
and the Go build dashboard (build.golang.org) only tests master and
the past two releases.

Also, the acme package makes no backwards compatibility guarantees,
not that I expect this to influence many people.

Change-Id: Ia1a294212e1e531f28f53cd954d4743a64611cab
Reviewed-on: https://go-review.googlesource.com/39272
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Brad Fitzpatrick 8 年之前
父節點
當前提交
88915ccf7a

+ 1 - 1
acme/acme.go

@@ -15,6 +15,7 @@ package acme
 
 
 import (
 import (
 	"bytes"
 	"bytes"
+	"context"
 	"crypto"
 	"crypto"
 	"crypto/ecdsa"
 	"crypto/ecdsa"
 	"crypto/elliptic"
 	"crypto/elliptic"
@@ -37,7 +38,6 @@ import (
 	"sync"
 	"sync"
 	"time"
 	"time"
 
 
-	"golang.org/x/net/context"
 	"golang.org/x/net/context/ctxhttp"
 	"golang.org/x/net/context/ctxhttp"
 )
 )
 
 

+ 1 - 2
acme/acme_test.go

@@ -6,6 +6,7 @@ package acme
 
 
 import (
 import (
 	"bytes"
 	"bytes"
+	"context"
 	"crypto/rand"
 	"crypto/rand"
 	"crypto/rsa"
 	"crypto/rsa"
 	"crypto/tls"
 	"crypto/tls"
@@ -23,8 +24,6 @@ import (
 	"strings"
 	"strings"
 	"testing"
 	"testing"
 	"time"
 	"time"
-
-	"golang.org/x/net/context"
 )
 )
 
 
 // Decodes a JWS-encoded request and unmarshals the decoded JSON into a provided
 // Decodes a JWS-encoded request and unmarshals the decoded JSON into a provided

+ 1 - 1
acme/autocert/autocert.go

@@ -10,6 +10,7 @@ package autocert
 
 
 import (
 import (
 	"bytes"
 	"bytes"
+	"context"
 	"crypto"
 	"crypto"
 	"crypto/ecdsa"
 	"crypto/ecdsa"
 	"crypto/elliptic"
 	"crypto/elliptic"
@@ -30,7 +31,6 @@ import (
 	"time"
 	"time"
 
 
 	"golang.org/x/crypto/acme"
 	"golang.org/x/crypto/acme"
-	"golang.org/x/net/context"
 )
 )
 
 
 // pseudoRand is safe for concurrent use.
 // pseudoRand is safe for concurrent use.

+ 1 - 1
acme/autocert/autocert_test.go

@@ -5,6 +5,7 @@
 package autocert
 package autocert
 
 
 import (
 import (
+	"context"
 	"crypto"
 	"crypto"
 	"crypto/ecdsa"
 	"crypto/ecdsa"
 	"crypto/elliptic"
 	"crypto/elliptic"
@@ -27,7 +28,6 @@ import (
 	"time"
 	"time"
 
 
 	"golang.org/x/crypto/acme"
 	"golang.org/x/crypto/acme"
-	"golang.org/x/net/context"
 )
 )
 
 
 var discoTmpl = template.Must(template.New("disco").Parse(`{
 var discoTmpl = template.Must(template.New("disco").Parse(`{

+ 1 - 2
acme/autocert/cache.go

@@ -5,12 +5,11 @@
 package autocert
 package autocert
 
 
 import (
 import (
+	"context"
 	"errors"
 	"errors"
 	"io/ioutil"
 	"io/ioutil"
 	"os"
 	"os"
 	"path/filepath"
 	"path/filepath"
-
-	"golang.org/x/net/context"
 )
 )
 
 
 // ErrCacheMiss is returned when a certificate is not found in cache.
 // ErrCacheMiss is returned when a certificate is not found in cache.

+ 1 - 2
acme/autocert/cache_test.go

@@ -5,13 +5,12 @@
 package autocert
 package autocert
 
 
 import (
 import (
+	"context"
 	"io/ioutil"
 	"io/ioutil"
 	"os"
 	"os"
 	"path/filepath"
 	"path/filepath"
 	"reflect"
 	"reflect"
 	"testing"
 	"testing"
-
-	"golang.org/x/net/context"
 )
 )
 
 
 // make sure DirCache satisfies Cache interface
 // make sure DirCache satisfies Cache interface

+ 1 - 2
acme/autocert/renewal.go

@@ -5,11 +5,10 @@
 package autocert
 package autocert
 
 
 import (
 import (
+	"context"
 	"crypto"
 	"crypto"
 	"sync"
 	"sync"
 	"time"
 	"time"
-
-	"golang.org/x/net/context"
 )
 )
 
 
 // maxRandRenew is a maximum deviation from Manager.RenewBefore.
 // maxRandRenew is a maximum deviation from Manager.RenewBefore.

+ 1 - 1
acme/autocert/renewal_test.go

@@ -5,6 +5,7 @@
 package autocert
 package autocert
 
 
 import (
 import (
+	"context"
 	"crypto/ecdsa"
 	"crypto/ecdsa"
 	"crypto/elliptic"
 	"crypto/elliptic"
 	"crypto/rand"
 	"crypto/rand"
@@ -18,7 +19,6 @@ import (
 	"time"
 	"time"
 
 
 	"golang.org/x/crypto/acme"
 	"golang.org/x/crypto/acme"
-	"golang.org/x/net/context"
 )
 )
 
 
 func TestRenewalNext(t *testing.T) {
 func TestRenewalNext(t *testing.T) {