You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clone the project and navigate to the file charset/charset.go.
In the GetSupportedCharsets() function, the slices.SortFunc function is used to sort a slice of *Charset by the Name field.
2. What did you expect to see? (Required)
Expected the code to compile without errors and the sorting functionality using slices.SortFunc to work correctly with Charset objects.
3. What did you see instead? (Required)
The compilation failed with the following error message:
charset/charset.go:94:28: type func(i *Charset, j *Charset) int of func(i, j *Charset) int {…} does not match inferred type func(a *Charset, b *Charset) bool for func(a E, b E) bool external/com_github_go_mysql_org_go_mysql/replication/binlogsyncer.go:427
This error arises due to a breaking change in golang.org/x/exp/slices, where the signature of slices.SortFunc was changed from a less function (returning a boolean) to a comparison function (returning an integer). This change aligns the exp/slices package with the slices package introduced in Go 1.21.
4. Cause of the issue
The root cause of the issue is that the golang.org/x/exp/slices package was updated to match the Go 1.21 standard library slices package. This introduces a breaking change that affects projects using Go 1.19 (which lacks the slices package in the standard library) and relying on golang.org/x/exp/slices.
note: the golang.org/x/exp package was created to try experimentations and explicitly states that new versions may break existing code:
Warning: Packages here are experimental and unreliable. Some may one day be promoted to the main repository or other subrepository, or they may be modified arbitrarily or even disappear altogether.
6. What is your TiDB version? (Required)
N/A
The text was updated successfully, but these errors were encountered:
Bug Report
1. Minimal reproduce step (Required)
charset/charset.go
.GetSupportedCharsets()
function, theslices.SortFunc
function is used to sort a slice of*Charset
by theName
field.2. What did you expect to see? (Required)
Expected the code to compile without errors and the sorting functionality using
slices.SortFunc
to work correctly withCharset
objects.3. What did you see instead? (Required)
The compilation failed with the following error message:
This error arises due to a breaking change in
golang.org/x/exp/slices
, where the signature ofslices.SortFunc
was changed from aless function
(returning a boolean) to acomparison function
(returning an integer). This change aligns theexp/slices
package with theslices
package introduced in Go 1.21.4. Cause of the issue
The root cause of the issue is that the
golang.org/x/exp/slices
package was updated to match the Go 1.21 standard libraryslices
package. This introduces a breaking change that affects projects using Go 1.19 (which lacks theslices
package in the standard library) and relying ongolang.org/x/exp/slices
.5. The fix (Suggested)
note: the golang.org/x/exp package was created to try experimentations and explicitly states that new versions may break existing code:
6. What is your TiDB version? (Required)
N/A
The text was updated successfully, but these errors were encountered: