Skip to content

Commit

Permalink
PreCommitContextFn => PreCommitFnContext before v1.5
Browse files Browse the repository at this point in the history
To me, the former implies a "context function", which doesn't make
sense, whereas the latter implies a descriptor of the context: a
"function context", meaning the context provides a function.
  • Loading branch information
twmb committed May 2, 2022
1 parent 744a60e commit cba9e26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/kgo/consumer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -2068,12 +2068,12 @@ type commitContextFnT struct{}

var commitContextFn commitContextFnT

// PreCommitContextFn attaches fn to the context through WithValue. Using the
// PreCommitFnContext attaches fn to the context through WithValue. Using the
// context while committing allows fn to be called just before the commit is
// issued. This can be used to modify the actual commit, such as by associating
// metadata with partitions. If fn returns an error, the commit is not
// attempted.
func PreCommitContextFn(ctx context.Context, fn func(*kmsg.OffsetCommitRequest) error) context.Context {
func PreCommitFnContext(ctx context.Context, fn func(*kmsg.OffsetCommitRequest) error) context.Context {
return context.WithValue(ctx, commitContextFn, fn)
}

Expand Down

0 comments on commit cba9e26

Please sign in to comment.