mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-31 05:40:42 +00:00 
			
		
		
		
	godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
		
			
				
	
	
		
			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
 | |
| }
 |