Skip to content

Commit 41bb18b

Browse files
authored
add back Context type as alias to context.Context (golang#148)
Pull request golang#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, golang#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.
1 parent 8c9f03a commit 41bb18b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

peers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import (
2424
pb "github.com/golang/groupcache/groupcachepb"
2525
)
2626

27+
// Context is an alias to context.Context for backwards compatibility purposes.
28+
type Context = context.Context
29+
2730
// ProtoGetter is the interface that must be implemented by a peer.
2831
type ProtoGetter interface {
2932
Get(ctx context.Context, in *pb.GetRequest, out *pb.GetResponse) error

0 commit comments

Comments
 (0)