mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
c4f79d455f
As kubernetes 1.24.0 is released, updating kubernetes dependencies to 1.24.0 updates: #3086 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
24 lines
467 B
Go
24 lines
467 B
Go
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
|
|
}
|