lotus/build/version.go

52 lines
938 B
Go
Raw Normal View History

package build
2021-04-29 18:01:23 +00:00
import "os"
var CurrentCommit string
2020-06-01 18:43:51 +00:00
var BuildType int
const (
2021-04-21 22:52:18 +00:00
BuildDefault = 0
BuildMainnet = 0x1
Build2k = 0x2
BuildDebug = 0x3
BuildCalibnet = 0x4
BuildInteropnet = 0x5
BuildNerpanet = 0x6
BuildButterflynet = 0x7
2020-06-01 18:43:51 +00:00
)
func buildType() string {
switch BuildType {
case BuildDefault:
2020-06-01 19:11:37 +00:00
return ""
2021-01-20 06:47:27 +00:00
case BuildMainnet:
return "+mainnet"
2020-06-01 18:43:51 +00:00
case Build2k:
return "+2k"
2021-01-20 06:47:27 +00:00
case BuildDebug:
return "+debug"
case BuildCalibnet:
return "+calibnet"
2021-06-02 18:49:10 +00:00
case BuildInteropnet:
return "+interopnet"
2021-04-21 22:52:18 +00:00
case BuildNerpanet:
return "+nerpanet"
case BuildButterflynet:
return "+butterflynet"
2020-06-01 18:43:51 +00:00
default:
return "+huh?"
}
}
// BuildVersion is the local build version, set by build system
2021-07-28 02:54:23 +00:00
const BuildVersion = "1.11.2-dev"
2020-06-01 18:43:51 +00:00
func UserVersion() string {
2021-04-30 09:18:15 +00:00
if os.Getenv("LOTUS_VERSION_IGNORE_COMMIT") == "1" {
return BuildVersion
}
2020-06-01 18:43:51 +00:00
return BuildVersion + buildType() + CurrentCommit
}