@@ -50,6 +50,18 @@ other versions, convert the version back into a string, and get the original
50
50
string. Getting the original string is useful if the semantic version was coerced
51
51
into a valid form.
52
52
53
+ There are package level variables that affect how ` NewVersion ` handles parsing.
54
+
55
+ - ` CoerceNewVersion ` is ` true ` by default. When set to ` true ` it coerces non-compliant
56
+ versions into SemVer. For example, allowing a leading 0 in a major, minor, or patch
57
+ part. This enables the use of CalVer in versions even when not compliant with SemVer.
58
+ When set to ` false ` less coercion work is done.
59
+ - ` DetailedNewVersionErrors ` provides more detailed errors. It only has an affect when
60
+ ` CoerceNewVersion ` is set to ` false ` . When ` DetailedNewVersionErrors ` is set to ` true `
61
+ it can provide some more insight into why a version is invalid. Setting
62
+ ` DetailedNewVersionErrors ` to ` false ` is faster on performance but provides less
63
+ detailed error messages if a version fails to parse.
64
+
53
65
## Sorting Semantic Versions
54
66
55
67
A set of versions can be sorted using the ` sort ` package from the standard library.
@@ -160,6 +172,10 @@ means `>=1.2.3-BETA` will return `1.2.3-alpha`. What you might expect from case
160
172
sensitivity doesn't apply here. This is due to ASCII sort ordering which is what
161
173
the spec specifies.
162
174
175
+ The ` Constraints ` instance returned from ` semver.NewConstraint() ` has a property
176
+ ` IncludePrerelease ` that, when set to true, will return prerelease versions when calls
177
+ to ` Check() ` and ` Validate() ` are made.
178
+
163
179
### Hyphen Range Comparisons
164
180
165
181
There are multiple methods to handle ranges and the first is hyphens ranges.
0 commit comments