MCPcopy
hub / github.com/syncthing/syncthing / getVersion

Function getVersion

build.go:971–987  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

969}
970
971func getVersion() string {
972 // First try for a RELEASE file or $VERSION env var,
973 if ver, err := getReleaseVersion(); err == nil {
974 return ver
975 }
976 // ... then see if we have a Git tag.
977 if ver, err := getGitVersion(); err == nil {
978 if strings.Contains(ver, "-") {
979 // The version already contains a hash and stuff. See if we can
980 // find a current branch name to tack onto it as well.
981 return ver + getBranchSuffix()
982 }
983 return ver
984 }
985 // This seems to be a dev build.
986 return "unknown-dev"
987}
988
989func semanticVersion() (major, minor, patch int) {
990 r := regexp.MustCompile(`v(\d+)\.(\d+).(\d+)`)

Callers 4

runCommandFunction · 0.85
parseFlagsFunction · 0.85
shouldBuildSysoFunction · 0.85
semanticVersionFunction · 0.85

Calls 4

getReleaseVersionFunction · 0.85
getGitVersionFunction · 0.85
getBranchSuffixFunction · 0.85
ContainsMethod · 0.80

Tested by

no test coverage detected