go-options
go-options copied to clipboard
feat: use a simple template when neither Cmp or Stringer are generated
This PR allows go-options to switch to a simpler template when neither cmp or Stringer are requested. An example of the output can be found in the test/golden/configWithoutCmpOrStringer_options.go.tx file and, at the time of this PR results in the following:
package test
// Code generated by github.com/launchdarkly/go-options. DO NOT EDIT.
type NoCmpOrStringerOption func(c *configWithoutCmpOrStringer) error
func newConfigWithoutCmpOrStringer(options ...NoCmpOrStringerOption) (configWithoutCmpOrStringer, error) {
var c configWithoutCmpOrStringer
err := applyConfigWithoutCmpOrStringerOptions(&c, options...)
return c, err
}
func applyConfigWithoutCmpOrStringerOptions(c *configWithoutCmpOrStringer, options ...NoCmpOrStringerOption) error {
for _, o := range options {
if err := o(c); err != nil {
return err
}
}
return nil
}
func NoCmpOrStringerOptionMyInt(o int) NoCmpOrStringerOption {
return func(c *configWithoutCmpOrStringer) error {
c.myInt = o
return nil
}
}
In addition, this PR updates the vendoring and tooling.