-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON support and BumpVersion #9
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.