Skip to content

Commit

Permalink
Merge pull request #40 from icholy/master
Browse files Browse the repository at this point in the history
Fix example in README
  • Loading branch information
thrawn01 authored May 17, 2022
2 parents ece2929 + 7eb7c7d commit fa08e00
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
},
))

Expand Down

0 comments on commit fa08e00

Please sign in to comment.