github.com/Ownercz/glide@v0.13.4-0.20210823071621-a5ffe19e4499/docs/versions.md (about) 1 # Versions and Ranges 2 3 Glide supports [Semantic Versions](http://semver.org), SemVer ranges, branches, tags, and commit ids as versions. 4 5 ## Basic Ranges 6 A simple range is in the form `> 1.2.3`. This tells Glide to use the latest versions that's after `1.2.3`. Glide has support for the following operators: 7 8 * `=`: equal (aliased to no operator) 9 * `!=`: not equal 10 * `>`: greater than 11 * `<`: less than 12 * `>=`: greater than or equal to 13 * `<=`: less than or equal to 14 15 These can be combined. A `,` is an and operator and a `||` is an or operator. The or operators cause groups of and operators to be checked. For example, `">= 1.2, < 3.0.0 || >= 4.2.3"`. 16 17 ## Hyphen Ranges 18 19 There are multiple shortcuts to handle ranges and the first is hyphens ranges. These look like: 20 21 * `1.2 - 1.4.5` which is equivalent to `>= 1.2, <= 1.4.5` 22 * `2.3.4 - 4.5` which is equivalent to `>= 2.3.4, <= 4.5` 23 24 ## Wildcards In Comparisons 25 26 The `x`, `X`, and `*` characters can be used as a wildcard character. This works for all comparison operators. When used on the `=` operator it falls back to the patch level comparison (see tilde below). For example, 27 28 * `1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` 29 * `>= 1.2.x` is equivalent to `>= 1.2.0` 30 * `<= 2.x` is equivalent to `< 3` 31 * `*` is equivalent to `>= 0.0.0` 32 33 ## Tilde Range Comparisons (Patch) 34 35 The tilde (`~`) comparison operator is for patch level ranges when a minor version is specified and major level changes when the minor number is missing. For example, 36 37 * `~1.2.3` is equivalent to `>= 1.2.3, < 1.3.0` 38 * `~1` is equivalent to `>= 1, < 2` 39 * `~2.3` is equivalent to `>= 2.3, < 2.4` 40 * `~1.2.x` is equivalent to `>= 1.2.0, < 1.3.0` 41 * `~1.x` is equivalent to `>= 1, < 2` 42 43 ## Caret Range Comparisons (Major) 44 45 The caret (`^`) comparison operator is for major level changes. This is useful when comparisons of API versions as a major change is API breaking. For example, 46 47 * `^1.2.3` is equivalent to `>= 1.2.3, < 2.0.0` 48 * `^1.2.x` is equivalent to `>= 1.2.0, < 2.0.0` 49 * `^2.3` is equivalent to `>= 2.3, < 3` 50 * `^2.x` is equivalent to `>= 2.0.0, < 3`