Version returns a version string. If the version variable in this package was set to a non-empty string by the linker, Version returns that. Otherwise, if build information is available via [debug.ReadBuildInfo], Version returns [debug.Buildinfo].Main.Version. Otherwise, Version returns "unknown".
()
| 11 | // Version returns [debug.Buildinfo].Main.Version. Otherwise, Version returns |
| 12 | // "unknown". |
| 13 | func Version() string { |
| 14 | if version != "" { |
| 15 | return version |
| 16 | } |
| 17 | if info, ok := debug.ReadBuildInfo(); ok { |
| 18 | // This will be "(devel)" for binaries not built by |
| 19 | // "go install PACKAGE@VERSION". |
| 20 | return info.Main.Version |
| 21 | } |
| 22 | return "unknown" |
| 23 | } |
no outgoing calls
no test coverage detected