gomega icon indicating copy to clipboard operation
gomega copied to clipboard

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

Open KevinJCross opened this issue 2 years ago • 4 comments

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.

KevinJCross avatar Nov 09 '22 10:11 KevinJCross

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

onsi avatar Nov 09 '22 13:11 onsi

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

silvestre avatar Nov 09 '22 14:11 silvestre

Thanks @onsi

KevinJCross avatar Nov 09 '22 14:11 KevinJCross

👍

onsi avatar Nov 09 '22 14:11 onsi