When using modules you may be able to get what you need from go mod graph
.
usage: go mod graph Graph prints the module requirement graph (with replacements applied) in text form. Each line in the output has two space-separated fields: a module and one of its requirements. Each module is identified as a string of the form path@version, except for the main module, which has no @version suffix.
I.e., for the original question, run go mod graph | grep github.com/Shopify/sarama
then look more closely at each entry on the left-hand side.