twmb/franz-go

Incorrect documentation regarding sarama partitioner compatibility SaramaCompatHasher

asg0451 opened this issue · 7 comments

This suggestion is incorrect and does not compile: https://github.com/twmb/franz-go/blob/v1.17.0/pkg/kgo/partitioner.go#L529
Perhaps something like this was meant:

	hasher := fnv.New32a()
	 kgo.StickyKeyPartitioner(kgo.SaramaCompatHasher(func(bs []byte) uint32 {
			hasher.Reset()
			_, _ = hasher.Write(bs)
			return hasher.Sum32()
		}))

twmb commented

Feel free to submit a PR, this really was meant to be more pseudocode but I'm fine if we want to make this 100% correct.

Gotcha. Can you confirm that what I wrote is correct? If so I'll submit a pr. thx

(or i can just add .. something like.. in the comment ;)

twmb commented

Open to anything; if you're able to test the code and then mirror that into a doc line, I'll +1 a PR. Or, if you'd prefer "something like", I'll +1 that too.