From cba9e26b737dbbe1ada2cd536e0c91219c1179b2 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Sun, 1 May 2022 18:32:08 -0600 Subject: [PATCH] PreCommitContextFn => PreCommitFnContext before v1.5 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. --- pkg/kgo/consumer_group.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kgo/consumer_group.go b/pkg/kgo/consumer_group.go index 6f273fcd..549f1cd9 100644 --- a/pkg/kgo/consumer_group.go +++ b/pkg/kgo/consumer_group.go @@ -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) }