Conversation
…n-marshal/unmarshal tests for both version and constraints
|
i was checking if a feature request for version incrementing already exists and found this PR. I would be happy to see the bump feature, if it returned a new object, leaving the original unchanged. |
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes 0 out of 2 committers have signed the CLA.
Burl Nyswonger seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
| err = json.Unmarshal(data, &constraintStr) | ||
| if err != nil { | ||
| return | ||
| } | ||
|
|
||
| nc, err = NewConstraint(constraintStr) | ||
| if err != nil { |
There was a problem hiding this comment.
| err = json.Unmarshal(data, &constraintStr) | |
| if err != nil { | |
| return | |
| } | |
| nc, err = NewConstraint(constraintStr) | |
| if err != nil { | |
| if err = json.Unmarshal(data, &constraintStr); err != nil { | |
| return | |
| } | |
| if nc, err = NewConstraint(constraintStr); err != nil { |
| nc, err = NewConstraint(constraintStr) | ||
| if err != nil { |
There was a problem hiding this comment.
| nc, err = NewConstraint(constraintStr) | |
| if err != nil { | |
| if nc, err = NewConstraint(constraintStr); err != nil { |
| func (c *Constraints) MarshalYAML() (str interface{}, err error) { | ||
| str = c.String() | ||
| return |
There was a problem hiding this comment.
| func (c *Constraints) MarshalYAML() (str interface{}, err error) { | |
| str = c.String() | |
| return | |
| func (c *Constraints) MarshalYAML() (interface{}, error) { | |
| return c.String(), nil |
| err = json.Unmarshal(data, &verStr) | ||
| if err != nil { | ||
| return | ||
| } | ||
|
|
||
| nv, err = NewVersion(verStr) | ||
| if err != nil { |
There was a problem hiding this comment.
| err = json.Unmarshal(data, &verStr) | |
| if err != nil { | |
| return | |
| } | |
| nv, err = NewVersion(verStr) | |
| if err != nil { | |
| if err = json.Unmarshal(data, &verStr); err != nil { | |
| return | |
| } | |
| if nv, err = NewVersion(verStr); err != nil { |
| func (v *Version) MarshalYAML() (str interface{}, err error) { | ||
| str = v.String() | ||
| return | ||
| } |
There was a problem hiding this comment.
| func (v *Version) MarshalYAML() (str interface{}, err error) { | |
| str = v.String() | |
| return | |
| } | |
| func (v *Version) MarshalYAML() (interface{}, error) { | |
| return v.String(), nil | |
| } |
JSON Marshal/UnMarshal support added.
BumpVersion() added, which allows one of Major, Minor or Patch part to be incremented.