onsi / gomega

Ginkgo's Preferred Matcher Library
http://onsi.github.io/gomega/
MIT License
2.16k stars 282 forks source link

`Eventually` has a breaking change from 1.22.1 -> 1.23.0 #605

Open KevinJCross opened 1 year ago

KevinJCross commented 1 year ago

hi, There is a very subtle breaking change from 1.22.1 to version 1.23.0 The prototype of Eventually changed to some thing that is causing compile errors on old code. The previous declaration was

func Eventually(actual interface{}, args ...interface{}) AsyncAssertion {

The declation in 1.23.0 is

func Eventually(args ...interface{}) AsyncAssertion {

These are explicitly different. The version in 1.22.1 requires at least one argument and the version in 1.23.0 does not require any argument. Why it is not backardly compatible? The flattening of arrays into veradic arguments is broken ... see below.

On go 1.19.3, 1.19.2 and 1.18.5 we have this issue which you can replicate using this sample test code


func test1(args ...string)              {}
func test2(name string, args ...string) {}

func testFail() {
    colours := []string{"orange", "green"}
        // this does not compile: Invalid use of '...', the corresponding parameter is non-variadic
    test1("Fred", colours...)
        // this compiles
    test2("Fred", colours...)
}

This change needs to be reverted or it needs to be 2.0.0 to keep the semantic versioning.

onsi commented 1 year ago

Hey there @KevinJCross - sorry for the disruption. I just shipped 1.24.1 which restores backwards compatibility

silvestre commented 1 year ago

Hi @onsi, thank you very much for the super-quick fix! We were already able to update to the new version: https://github.com/cloudfoundry/app-autoscaler-release/pull/1034

KevinJCross commented 1 year ago

Thanks @onsi

onsi commented 1 year ago

👍