mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-05 21:56:50 +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
|
||||
|
||||
// Version returns the application version as a properly formed string
|
||||
func Version() string {
|
||||
func init() {
|
||||
if version == "" {
|
||||
// Start with the major, minor, and patch versions.
|
||||
version = fmt.Sprintf("%d.%d.%d", appMajor, appMinor, appPatch)
|
||||
@ -35,7 +34,10 @@ func Version() string {
|
||||
version = fmt.Sprintf("%s-%s", version, appBuild)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Version returns the application version as a properly formed string
|
||||
func Version() string {
|
||||
return version
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user