From 7eb7c7d0dc031bfd878d47f518ab16b640c909ad Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Sun, 15 May 2022 17:15:20 -0400 Subject: [PATCH] Fix example in README --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8d44876..6161682 100644 --- a/README.md +++ b/README.md @@ -122,15 +122,13 @@ func ExampleUsage() { func(ctx context.Context, id string, dest groupcache.Sink) error { // Returns a protobuf struct `User` - if user, err := fetchUserFromMongo(ctx, id); err != nil { + user, err := fetchUserFromMongo(ctx, id) + if err != nil { return err } // Set the user in the groupcache to expire after 5 minutes - if err := dest.SetProto(&user, time.Now().Add(time.Minute*5)); err != nil { - return err - } - return nil + return dest.SetProto(&user, time.Now().Add(time.Minute*5)) }, ))