45 lines
720 B
Go
45 lines
720 B
Go
package build
|
|
|
|
import "os"
|
|
|
|
var CurrentCommit string
|
|
var BuildType int
|
|
|
|
func init() {
|
|
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
|
|
CurrentCommit = ""
|
|
}
|
|
}
|
|
|
|
const (
|
|
BuildDefault = 0
|
|
BuildMainnet = 0x1
|
|
Build2k = 0x2
|
|
BuildDebug = 0x3
|
|
BuildCalibnet = 0x4
|
|
)
|
|
|
|
func buildType() string {
|
|
switch BuildType {
|
|
case BuildDefault:
|
|
return ""
|
|
case BuildMainnet:
|
|
return "+mainnet"
|
|
case Build2k:
|
|
return "+2k"
|
|
case BuildDebug:
|
|
return "+debug"
|
|
case BuildCalibnet:
|
|
return "+calibnet"
|
|
default:
|
|
return "+huh?"
|
|
}
|
|
}
|
|
|
|
// BuildVersion is the local build version, set by build system
|
|
const BuildVersion = "1.11.0-dev"
|
|
|
|
func UserVersion() string {
|
|
return BuildVersion + buildType() + CurrentCommit
|
|
}
|