summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2021-03-31 15:47:55 -0700
committerGitHub <noreply@github.com>2021-03-31 18:47:55 -0400
commit41bb18bfe9da5321badc438f91158cd790a33aa3 (patch)
tree5e4fbe7aa6bb5cfdb3c4ac8de94d63e19f2b413e
parent8c9f03a8e57eb486e42badaed3fb287da51807ba (diff)
downloadgolang-groupcache-upstream-master.tar.gz
add back Context type as alias to context.Context (#148)upstream-master
Pull request #131 deleted the Context declaration, which broke most usages of this package since users needed to implement the interfaces mentioned in this package by referencing the groupcache.Context type. However, that type was removed from peers.go in the mentioned pull request. Technically, #131 is a breaking change since groupcache.Context was an interface{}, and the PR switched it to be context.Context. Fortunately, it seems that all users are passing a context.Context anyways so that the type safety just checks out. However, most users are still referencing groupcache.Context.
-rw-r--r--peers.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/peers.go b/peers.go
index 33e1fba..552c0ae 100644
--- a/peers.go
+++ b/peers.go
@@ -24,6 +24,9 @@ import (
pb "github.com/golang/groupcache/groupcachepb"
)
+// Context is an alias to context.Context for backwards compatibility purposes.
+type Context = context.Context
+
// ProtoGetter is the interface that must be implemented by a peer.
type ProtoGetter interface {
Get(ctx context.Context, in *pb.GetRequest, out *pb.GetResponse) error