Skip to content

Commit

Permalink
add back Context type as alias to context.Context (#148)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dsnet authored Mar 31, 2021
1 parent 8c9f03a commit 41bb18b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 41bb18b

Please sign in to comment.