mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-07 14:46:44 +00:00
Move version initializiation to init function to prevent race conditions (#1299)
This commit is contained in:
parent
c7c8b25c09
commit
af1b8c8490
@ -21,8 +21,7 @@ var appBuild string
|
|||||||
|
|
||||||
var version = "" // string used for memoization of version
|
var version = "" // string used for memoization of version
|
||||||
|
|
||||||
// Version returns the application version as a properly formed string
|
func init() {
|
||||||
func Version() string {
|
|
||||||
if version == "" {
|
if version == "" {
|
||||||
// Start with the major, minor, and patch versions.
|
// Start with the major, minor, and patch versions.
|
||||||
version = fmt.Sprintf("%d.%d.%d", appMajor, appMinor, appPatch)
|
version = fmt.Sprintf("%d.%d.%d", appMajor, appMinor, appPatch)
|
||||||
@ -35,7 +34,10 @@ func Version() string {
|
|||||||
version = fmt.Sprintf("%s-%s", version, appBuild)
|
version = fmt.Sprintf("%s-%s", version, appBuild)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Version returns the application version as a properly formed string
|
||||||
|
func Version() string {
|
||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user