cosmos sdk does not compile with new slices package

203 Views Asked by At

While compiling a cosmos sdk project I am getting this /root/go/pkg/mod/github.com/cosmos/[email protected]/runtime/services/reflection.go:60:28: type func(x *descriptorpb.FileDescriptorProto, y *descriptorpb.FileDescriptorProto) bool of func(x, y *descriptorpb.FileDescriptorProto) bool {…} does not match inferred type func(a *descriptorpb.FileDescriptorProto, b *descriptorpb.FileDescriptorProto) int for func(a E, b E) int

This is du to the slices package, as the sortFunc is now returning an int. How can we do a replace of the slices go package ?

Would you any idea ?

1

There are 1 best solutions below

0
starball On

Maintainer Julien Robert replied in issue ticket [Bug]: cosmos sdk 0.47.5 does not compile with new go slices package #18415 that it's precisely because the exp package has an API change that they didn't bump it to the new version in v0.47. Quoting the rest of their reply:

Patch releases must not contain any breaking changes. What you can do it downgrade and use the same version that is used in the SDK. Another solution, although overkill, is to upgrade to v0.50 with contains latest x/exp.

Another user there reports that they solved the problem by changing go.mod to go 1.19, removing the golang.org/x/exp indirect package, and then running go mod tidy again.