vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.19k stars 2.06k forks source link

Bug Report: `go vet` fails on `vitess.io/vitess` v0.17.0+ #13850

Open mbrancato opened 10 months ago

mbrancato commented 10 months ago

Overview of the Issue

Using go vet, the vitess library fails. https://pkg.go.dev/cmd/vet

# vitess.io/vitess/go/mysql/json
/Users/mike/go/pkg/mod/vitess.io/vitess@v0.17.2/go/mysql/json/parser.go:588:31: type func(a kv, b kv) bool of func(a, b kv) bool {…} does not match inferred type func(a kv, b kv) int for func(a E, b E) int

I'm using Go 1.20.x. Version 0.16.x passes just fine.

Reproduction Steps

Binary Version

0.17.0+

Operating System and Environment details

MacOS

Log Fragments

No response

ajm188 commented 10 months ago

i cannot reproduce this:

➜  vitess git:(vmain) ✗ go vet ./go/mysql/...
➜  vitess git:(vmain) ✗ go version
go version go1.20.5 darwin/arm64
➜  vitess git:(vmain) ✗ git switch --detach upstream/release-17.0
HEAD is now at 0c0377d2c1 [release-17.0] Flakes: empty vtdataroot before starting a new vreplication e2e test (#13803) (#13822)
➜  vitess git:(0c0377d2c1) ✗ go vet ./go/mysql/...
➜  vitess git:(0c0377d2c1) ✗ git switch --detach v17.0.2 
HEAD is now at 96ac0a691d Release of v17.0.2 (#13809)
➜  vitess git:(96ac0a691d) ✗ go vet ./go/mysql/...      
➜  vitess git:(96ac0a691d) ✗ 

I found https://github.com/vitessio/vitess/commit/effc60e8221331986f9a9117e6e48da4f33b3b2a which changed the signature of the function in question, and checking out its parent doesn't reproduce either:

➜  vitess git:(vmain) ✗ git checkout 13d1aad
Note: switching to '13d1aad'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 13d1aad566 Per workload TxThrottler metrics (#13526)
➜  vitess git:(13d1aad566) ✗ go vet ./go/mysql/...
➜  vitess git:(13d1aad566) ✗
tinmrn commented 9 months ago

Looks like it's because of golang.org/x/exp

Script to reproduce: https://gist.github.com/tinmrn/4b00ea3345450492eece64e7e4d96726

+ go version
go version go1.21.1 linux/amd64

...

+ go vet ./...
# vitess.io/vitess/go/mysql/json
/home/bas/go/pkg/mod/vitess.io/vitess@v0.17.2/go/mysql/json/parser.go:588:31: type func(a kv, b kv) bool of func(a, b kv) bool {…} does not match inferred type func(a kv, b kv) int for func(a E, b E) int
alextanhongpin commented 8 months ago

I'm facing this issue too. The solution was to downgrade golang.org/x/exp:

$ go get golang.org/x/exp@v0.0.0-20230905200255-921286631fa9

That version above is taken from https://pkg.go.dev/golang.org/x/exp?tab=versions and seems to be working.