github.com/sberex/go-sberex@v1.8.2-0.20181113200658-ed96ac38f7d7/params/version.go (about) 1 // This file is part of the go-sberex library. The go-sberex library is 2 // free software: you can redistribute it and/or modify it under the terms 3 // of the GNU Lesser General Public License as published by the Free 4 // Software Foundation, either version 3 of the License, or (at your option) 5 // any later version. 6 // 7 // The go-sberex library is distributed in the hope that it will be useful, 8 // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 10 // General Public License <http://www.gnu.org/licenses/> for more details. 11 12 package params 13 14 import ( 15 "fmt" 16 ) 17 18 const ( 19 VersionMajor = 1 // Major version component of the current release 20 VersionMinor = 8 // Minor version component of the current release 21 VersionPatch = 2 // Patch version component of the current release 22 VersionMeta = "unstable" // Version metadata to append to the version string 23 ) 24 25 // Version holds the textual version string. 26 var Version = func() string { 27 v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) 28 if VersionMeta != "" { 29 v += "-" + VersionMeta 30 } 31 return v 32 }() 33 34 func VersionWithCommit(gitCommit string) string { 35 vsn := Version 36 if len(gitCommit) >= 8 { 37 vsn += "-" + gitCommit[:8] 38 } 39 return vsn 40 }