You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cointop/cointop/version.go

34 lines
566 B
Go

6 years ago
package cointop
import (
"fmt"
"os"
"runtime/debug"
)
// version is the cointop version which will be populated by ldflags
var version string = "(unknown)"
6 years ago
// Version returns the cointop version
func (ct *Cointop) Version() string {
return Version()
6 years ago
}
// Version returns cointop version
func Version() string {
if version != "(unknown)" {
return version
}
if buildInfo, ok := debug.ReadBuildInfo(); ok {
return buildInfo.Main.Version
}
6 years ago
return version
}
// PrintVersion prints the version
func PrintVersion() {
fmt.Fprint(os.Stdout, Version())
}