From 88915ccf7aeb91e9324fe7cf3eddd1531ced61ea Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 2 Apr 2017 13:18:05 -0700 Subject: [PATCH] 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 Reviewed-by: Alex Vaghin TryBot-Result: Gobot Gobot --- acme/acme.go | 2 +- acme/acme_test.go | 3 +-- acme/autocert/autocert.go | 2 +- acme/autocert/autocert_test.go | 2 +- acme/autocert/cache.go | 3 +-- acme/autocert/cache_test.go | 3 +-- acme/autocert/renewal.go | 3 +-- acme/autocert/renewal_test.go | 2 +- 8 files changed, 8 insertions(+), 12 deletions(-) diff --git a/acme/acme.go b/acme/acme.go index 8619508e..03e24e45 100644 --- a/acme/acme.go +++ b/acme/acme.go @@ -15,6 +15,7 @@ package acme import ( "bytes" + "context" "crypto" "crypto/ecdsa" "crypto/elliptic" @@ -37,7 +38,6 @@ import ( "sync" "time" - "golang.org/x/net/context" "golang.org/x/net/context/ctxhttp" ) diff --git a/acme/acme_test.go b/acme/acme_test.go index 1205dbb3..e746c079 100644 --- a/acme/acme_test.go +++ b/acme/acme_test.go @@ -6,6 +6,7 @@ package acme import ( "bytes" + "context" "crypto/rand" "crypto/rsa" "crypto/tls" @@ -23,8 +24,6 @@ import ( "strings" "testing" "time" - - "golang.org/x/net/context" ) // Decodes a JWS-encoded request and unmarshals the decoded JSON into a provided diff --git a/acme/autocert/autocert.go b/acme/autocert/autocert.go index dfb860f4..f50c88e8 100644 --- a/acme/autocert/autocert.go +++ b/acme/autocert/autocert.go @@ -10,6 +10,7 @@ package autocert import ( "bytes" + "context" "crypto" "crypto/ecdsa" "crypto/elliptic" @@ -30,7 +31,6 @@ import ( "time" "golang.org/x/crypto/acme" - "golang.org/x/net/context" ) // pseudoRand is safe for concurrent use. diff --git a/acme/autocert/autocert_test.go b/acme/autocert/autocert_test.go index c3f3f66e..acef1625 100644 --- a/acme/autocert/autocert_test.go +++ b/acme/autocert/autocert_test.go @@ -5,6 +5,7 @@ package autocert import ( + "context" "crypto" "crypto/ecdsa" "crypto/elliptic" @@ -27,7 +28,6 @@ import ( "time" "golang.org/x/crypto/acme" - "golang.org/x/net/context" ) var discoTmpl = template.Must(template.New("disco").Parse(`{ diff --git a/acme/autocert/cache.go b/acme/autocert/cache.go index 9b184aab..9f3e9d13 100644 --- a/acme/autocert/cache.go +++ b/acme/autocert/cache.go @@ -5,12 +5,11 @@ package autocert import ( + "context" "errors" "io/ioutil" "os" "path/filepath" - - "golang.org/x/net/context" ) // ErrCacheMiss is returned when a certificate is not found in cache. diff --git a/acme/autocert/cache_test.go b/acme/autocert/cache_test.go index ad6d4a46..6e1b88d5 100644 --- a/acme/autocert/cache_test.go +++ b/acme/autocert/cache_test.go @@ -5,13 +5,12 @@ package autocert import ( + "context" "io/ioutil" "os" "path/filepath" "reflect" "testing" - - "golang.org/x/net/context" ) // make sure DirCache satisfies Cache interface diff --git a/acme/autocert/renewal.go b/acme/autocert/renewal.go index 0d2eb607..14ac9055 100644 --- a/acme/autocert/renewal.go +++ b/acme/autocert/renewal.go @@ -5,11 +5,10 @@ package autocert import ( + "context" "crypto" "sync" "time" - - "golang.org/x/net/context" ) // maxRandRenew is a maximum deviation from Manager.RenewBefore. diff --git a/acme/autocert/renewal_test.go b/acme/autocert/renewal_test.go index 27958bb0..87474b69 100644 --- a/acme/autocert/renewal_test.go +++ b/acme/autocert/renewal_test.go @@ -5,6 +5,7 @@ package autocert import ( + "context" "crypto/ecdsa" "crypto/elliptic" "crypto/rand" @@ -18,7 +19,6 @@ import ( "time" "golang.org/x/crypto/acme" - "golang.org/x/net/context" ) func TestRenewalNext(t *testing.T) {