github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/params/version.go (about)

     1  package params
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  const (
     8  	VersionMajor = 1
     9  	VersionMinor = 7
    10  	VersionPatch = 0
    11  	VersionMeta  = "unstable"
    12  )
    13  
    14  var Version = func() string {
    15  	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
    16  }()
    17  
    18  var VersionWithMeta = func() string {
    19  	v := Version
    20  	if VersionMeta != "" {
    21  		v += "-" + VersionMeta
    22  	}
    23  	return v
    24  }()
    25  
    26  func VersionWithCommit(gitCommit string) string {
    27  	vsn := Version
    28  	if len(gitCommit) >= 8 {
    29  		vsn += "-" + gitCommit[:8]
    30  	}
    31  	return vsn
    32  }