blob: d3b9d53ff944cceac7376a949f6388d1f459e65f [file] [log] [blame]
Abhay Kumar40252eb2025-10-13 13:25:53 +00001package sarama
2
3import (
4 "runtime/debug"
5 "sync"
6)
7
8var (
9 v string
10 vOnce sync.Once
11)
12
13func version() string {
14 vOnce.Do(func() {
15 bi, ok := debug.ReadBuildInfo()
16 if ok {
17 v = bi.Main.Version
18 }
19 if v == "" || v == "(devel)" {
20 // if we can't read a go module version then they're using a git
21 // clone or vendored module so all we can do is report "dev" for
22 // the version to make a valid ApiVersions request
23 v = "dev"
24 }
25 })
26 return v
27}