diff options
author | Sascha Grunert <sgrunert@redhat.com> | 2022-07-14 13:33:23 +0200 |
---|---|---|
committer | Sascha Grunert <sgrunert@redhat.com> | 2022-07-14 13:53:13 +0200 |
commit | 66cb856f9dc722d596ac7d1cbfbff21346bcfc6e (patch) | |
tree | e6b33ccc5c1b5d0898a629d784e342a011afd869 /vendor/github.com/blang/semver/v4/json.go | |
parent | 5c3eec55895c9ca4c36571e1e919f0cb8632bedb (diff) | |
download | podman-66cb856f9dc722d596ac7d1cbfbff21346bcfc6e.tar.gz podman-66cb856f9dc722d596ac7d1cbfbff21346bcfc6e.tar.bz2 podman-66cb856f9dc722d596ac7d1cbfbff21346bcfc6e.zip |
Switch to `github.com/blang/semver/v4`
Switch to the latest version of the now go module compatible release.
[NO NEW TESTS NEEDED]
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Diffstat (limited to 'vendor/github.com/blang/semver/v4/json.go')
-rw-r--r-- | vendor/github.com/blang/semver/v4/json.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/github.com/blang/semver/v4/json.go b/vendor/github.com/blang/semver/v4/json.go new file mode 100644 index 000000000..a74bf7c44 --- /dev/null +++ b/vendor/github.com/blang/semver/v4/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 +} |