@@ -50,6 +50,18 @@ other versions, convert the version back into a string, and get the original
5050string. Getting the original string is useful if the semantic version was coerced
5151into a valid form.
5252
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+
5365## Sorting Semantic Versions
5466
5567A 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
160172sensitivity doesn't apply here. This is due to ASCII sort ordering which is what
161173the spec specifies.
162174
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+
163179### Hyphen Range Comparisons
164180
165181There are multiple methods to handle ranges and the first is hyphens ranges.
0 commit comments