Skip to content

@mattfarina mattfarina released this Sep 12, 2019 · 2 commits to master since this release

This is a major release of the semver package which includes API changes. The Go
API is compatible with ^1. The Go API was not changed because many people are using
go get without Go modules for their applications and API breaking changes cause
errors which we have or would need to support.

The changes in this release are the handling based on the data passed into the
functions. These are described in the added and changed sections below.

Added

  • StrictNewVersion function. This is similar to NewVersion but will return an
    error if the version passed in is not a strict semantic version. For example,
    1.2.3 would pass but v1.2.3 or 1.2 would fail because they are not strictly
    speaking semantic versions. This function is faster, performs fewer operations,
    and uses fewer allocations than NewVersion.
  • Fuzzing has been performed on NewVersion, StrictNewVersion, and NewConstraint.
    The Makefile contains the operations used. For more information on you can start
    on Wikipedia at https://en.wikipedia.org/wiki/Fuzzing
  • Now using Go modules

Changed

  • NewVersion has proper prerelease and metadata validation with error messages
    to signal an issue with either of them
  • Handles space separated AND conditions in addition to ,
  • ^ now operates using a similar set of rules to npm/js and Rust/Cargo. If the
    version is >=1 the ^ ranges works the same as v1. For major versions of 0 the
    rules have changed. The minor version is treated as the stable version unless
    a patch is specified and then it is equivalent to =. One difference from npm/js
    is that prereleases there are only to a specific version (e.g. 1.2.3).
    Prereleases here look over multiple versions and follow semantic version
    ordering rules. This pattern now follows along with the expected and requested
    handling of this packaged by numerous users.
Assets 2
You can’t perform that action at this time.