onsi / gomega

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

1.34.0 cannot be used with golang 1.20 #774

Closed gibizer closed 1 month ago

gibizer commented 1 month ago

Bumping from 1.33.1 to 1.34.0 in a golang 1.20 project fails with:

/home/gibi/go/pkg/mod/github.com/onsi/gomega@v1.34.0/matchers/support/goraph/bipartitegraph/bipartitegraphmatching.go:4:2: package slices is not in GOROOT (/usr/lib/go-1.20/src/slices)

See also: https://github.com/openstack-k8s-operators/nova-operator/pull/837#issuecomment-2253749772

I think the fix in https://github.com/onsi/gomega/pull/766 introduced "slices" dependency that is not in the standard lib in golang 1.20

onsi commented 1 month ago

hey there - I'll pull in the PR but need to point out that there is no LTS release for Gomega. Gomega supports the latest two versions of Go in line with Go's own release policy - so 1.20 is, formally, not "officially" supported any more.

gibizer commented 1 month ago

Thansk for accepting the fix.

Of course an alternative fix would be to declares 1.21 as minimum golang version in the go.mod file. https://github.com/onsi/gomega/blob/fa057b845528c9336265d6df77e21d827f268c7d/go.mod#L3 But since it was still stating 1.20 I thought that the intention was to keep the compatibility. So I formulated my fix in a way to make the least disturbing change.

Thank you for your effort on gomega!