File: version.go

package info (click to toggle)
golang-github-ibm-sarama 1.45.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,964 kB
  • sloc: makefile: 35; sh: 19
file content (27 lines) | stat: -rw-r--r-- 463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package sarama

import (
	"runtime/debug"
	"sync"
)

var (
	v     string
	vOnce sync.Once
)

func version() string {
	vOnce.Do(func() {
		bi, ok := debug.ReadBuildInfo()
		if ok {
			v = bi.Main.Version
		}
		if v == "" || v == "(devel)" {
			// if we can't read a go module version then they're using a git
			// clone or vendored module so all we can do is report "dev" for
			// the version to make a valid ApiVersions request
			v = "dev"
		}
	})
	return v
}