I believe adding variadic function to a regular function or method is breaking change based on this post. But what about adding variadic parameters to a constructor function? like adding Functional Options.
By using semver this code is v1.0.0
type Foo struct{}
// constructor with default behavior
func NewFoo() *Foo {
return &Foo{}
}
Adding a variadic parameter
type Foo struct{}
type Option func(&Foo)
// constructor with option
func NewFoo(opts ...Option) *Foo {
// process option before return
// ...
return &Foo{}
}
Old code still fine when calling the constructor function and no one assigns constructor to a variable and passing around constructor to another function like in this case.
So, in the above code, should I increment the major version to v2.0.0 or the minor one to v1.1.0?