mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	Don't use standard lib context package (#1468)
With Go 1.9 you *can* include the std lib's context package and nothing breaks. However we never officially made the move (and grpc also doesn't ues the std lib's one). Standardize all plugins on using the extern context package. Fixes #1466
This commit is contained in:
		
				
					committed by
					
						 John Belamaric
						John Belamaric
					
				
			
			
				
	
			
			
			
						parent
						
							449bb1ac6c
						
					
				
				
					commit
					f91cb61086
				
			| @@ -3,7 +3,6 @@ | |||||||
| package etcd | package etcd | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" |  | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"testing" | 	"testing" | ||||||
| 	"time" | 	"time" | ||||||
| @@ -16,6 +15,7 @@ import ( | |||||||
|  |  | ||||||
| 	etcdc "github.com/coreos/etcd/client" | 	etcdc "github.com/coreos/etcd/client" | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
|   | |||||||
| @@ -1,13 +1,13 @@ | |||||||
| package proxy | package proxy | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" |  | ||||||
| 	"net" | 	"net" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/coredns/coredns/request" | 	"github.com/coredns/coredns/request" | ||||||
|  |  | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type dnsEx struct { | type dnsEx struct { | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| package proxy | package proxy | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" |  | ||||||
|  |  | ||||||
| 	"github.com/coredns/coredns/request" | 	"github.com/coredns/coredns/request" | ||||||
|  |  | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Exchanger is an interface that specifies a type implementing a DNS resolver that | // Exchanger is an interface that specifies a type implementing a DNS resolver that | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| package proxy | package proxy | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" |  | ||||||
| 	"crypto/tls" | 	"crypto/tls" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| @@ -16,6 +15,7 @@ import ( | |||||||
| 	"github.com/coredns/coredns/request" | 	"github.com/coredns/coredns/request" | ||||||
|  |  | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type google struct { | type google struct { | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| package proxy | package proxy | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" |  | ||||||
| 	"crypto/tls" | 	"crypto/tls" | ||||||
| 	"log" | 	"log" | ||||||
|  |  | ||||||
| @@ -12,6 +11,7 @@ import ( | |||||||
| 	"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" | 	"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
| 	opentracing "github.com/opentracing/opentracing-go" | 	opentracing "github.com/opentracing/opentracing-go" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| 	"google.golang.org/grpc" | 	"google.golang.org/grpc" | ||||||
| 	"google.golang.org/grpc/credentials" | 	"google.golang.org/grpc/credentials" | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -3,7 +3,6 @@ package proxy | |||||||
| // functions other plugin might want to use to do lookup in the same style as the proxy. | // functions other plugin might want to use to do lookup in the same style as the proxy. | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" |  | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"net" | 	"net" | ||||||
| 	"sync/atomic" | 	"sync/atomic" | ||||||
| @@ -13,6 +12,7 @@ import ( | |||||||
| 	"github.com/coredns/coredns/request" | 	"github.com/coredns/coredns/request" | ||||||
|  |  | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // NewLookup create a new proxy with the hosts in host and a Random policy. | // NewLookup create a new proxy with the hosts in host and a Random policy. | ||||||
|   | |||||||
| @@ -2,7 +2,6 @@ package template | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"bytes" | ||||||
| 	"context" |  | ||||||
| 	"regexp" | 	"regexp" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	gotmpl "text/template" | 	gotmpl "text/template" | ||||||
| @@ -12,6 +11,7 @@ import ( | |||||||
| 	"github.com/coredns/coredns/request" | 	"github.com/coredns/coredns/request" | ||||||
|  |  | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // Handler is a plugin handler that takes a query and templates a response. | // Handler is a plugin handler that takes a query and templates a response. | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| package template | package template | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" |  | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"regexp" | 	"regexp" | ||||||
| 	"testing" | 	"testing" | ||||||
| @@ -13,6 +12,7 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/mholt/caddy" | 	"github.com/mholt/caddy" | ||||||
| 	"github.com/miekg/dns" | 	"github.com/miekg/dns" | ||||||
|  | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func TestHandler(t *testing.T) { | func TestHandler(t *testing.T) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user