From 08f9bafd09c8452a60ee603a744188c1a823cb3c Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Sun, 7 Jul 2019 13:37:22 +0200 Subject: Add blang/semver vendors --- vendor/github.com/blang/semver/json.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 vendor/github.com/blang/semver/json.go (limited to 'vendor/github.com/blang/semver/json.go') diff --git a/vendor/github.com/blang/semver/json.go b/vendor/github.com/blang/semver/json.go new file mode 100644 index 00000000..a74bf7c4 --- /dev/null +++ b/vendor/github.com/blang/semver/json.go @@ -0,0 +1,23 @@ +package semver + +import ( + "encoding/json" +) + +// MarshalJSON implements the encoding/json.Marshaler interface. +func (v Version) MarshalJSON() ([]byte, error) { + return json.Marshal(v.String()) +} + +// UnmarshalJSON implements the encoding/json.Unmarshaler interface. +func (v *Version) UnmarshalJSON(data []byte) (err error) { + var versionString string + + if err = json.Unmarshal(data, &versionString); err != nil { + return + } + + *v, err = Parse(versionString) + + return +} -- cgit