| 96 | } |
| 97 | |
| 98 | func parseBuildPlaceholderVersionBuildNumberString(s string) (rawVersion, major, minor, patch, other, build string) { |
| 99 | // Split version number and build number (optional) |
| 100 | versionAndBuild := strings.Split(s, "-") |
| 101 | |
| 102 | rawVersion = versionAndBuild[0] |
| 103 | versions := strings.Split(rawVersion, ".") |
| 104 | if len(versions) == 0 || len(versions) > 4 { |
| 105 | PanicfCtx(context.Background(), "unknown version format (expected major.minor.patch[.other]) got %v", rawVersion) |
| 106 | } |
| 107 | |
| 108 | if len(versions) > 0 { |
| 109 | major = versions[0] |
| 110 | } |
| 111 | if len(versions) > 1 { |
| 112 | minor = versions[1] |
| 113 | } |
| 114 | if len(versions) > 2 { |
| 115 | patch = versions[2] |
| 116 | } |
| 117 | if len(versions) > 3 { |
| 118 | other = versions[3] |
| 119 | } |
| 120 | |
| 121 | if len(versionAndBuild) > 1 { |
| 122 | build = versionAndBuild[1] |
| 123 | } |
| 124 | |
| 125 | return rawVersion, major, minor, patch, other, build |
| 126 | } |
| 127 | |
| 128 | // IsEnterpriseEdition returns true if this Sync Gateway node is enterprise edition. |
| 129 | // This can be used to restrict config options, etc. at runtime. This should not be |