Skip to content
Node: semver.parse(v)github.com/sahilkhaire/gox/semver

Version.Parse

Overview ​

Parse parses a semver string.

If you are coming from Node.js, the closest pattern is semver.parse(v).

Method on Version — call it on a value of that type after constructing or receiving one from a constructor.

Signature ​

go
func Parse(v string) (*Version, error)

Compare: Node.js · Standard Go · gox ​

js
semver.parse('1.2.3');
go
// github.com/Masterminds/semver/v3
go
import "github.com/sahilkhaire/gox/semver"

v, err := semver.Parse("1.2.3")

Example ​

go
import "github.com/sahilkhaire/gox/semver"

v, err := semver.Parse("1.2.3")

Tips ​

Obtain a Version value first (see constructors on the package overview), then call Parse.

Standard library alternative ​

gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.

← Back to semver package overview

MIT Licensed · Built for Node.js developers moving to Go