kesavand | c71914f | 2022-03-25 11:19:03 +0530 | [diff] [blame] | 1 | package sarama |
2 | |||||
3 | import "runtime/debug" | ||||
4 | |||||
5 | var v string | ||||
6 | |||||
7 | func version() string { | ||||
8 | if v == "" { | ||||
9 | bi, ok := debug.ReadBuildInfo() | ||||
10 | if ok { | ||||
11 | v = bi.Main.Version | ||||
12 | } else { | ||||
13 | // if we can't read a go module version then they're using a git | ||||
14 | // clone or vendored module so all we can do is report "dev" for | ||||
15 | // the version | ||||
16 | v = "dev" | ||||
17 | } | ||||
18 | } | ||||
19 | return v | ||||
20 | } |