// Package version contains gotd module version getter.
package version import ( ) var versionOnce struct { version string sync.Once } // GetVersion optimistically gets current client version. // // Does not handle replace directives. func () string { versionOnce.Do(func() { , := debug.ReadBuildInfo() if ! { return } // Hard-coded package name. Probably we can generate this via parsing // the go.mod file. const = "github.com/gotd/td" for , := range .Deps { if strings.HasPrefix(.Path, ) { versionOnce.version = .Version break } } }) return versionOnce.version }