testify
testify copied to clipboard
[BUG] assert.New() is broken on go1.8
func TestFunc(t *testing.T) {
assert := assert.New(t)
}
Error message:
[compiler InvalidIfaceAssign] [E] cannot use t (variable of type *testing.T) as assert.TestingT value in argument to assert.New: wrong type for method Errorf (have func(format string, args ...invalid type), want func(format string, args ...interface{}))
Same for require pkg
cannot use t (variable of type *testing.T) as require.TestingT value in argument to require.Equal: wrong type for method Errorf (have func(format string, args ...invalid type), want func(format string, args ...interface{}))compiler[InvalidIfaceAssign](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal?utm_source%3Dgopls#InvalidIfaceAssign)
go version go1.18 darwin/amd64 golang.org/x/tools/gopls v0.8.1
=== upd ===
the next day it somehow worked, although the versions did not change.
Same here.
Works on 1.18 for me. Are you sure your editors are updated correctly? This looks like #1138 again.
Yeah, for me now it's ok. Maybe vscode was taking time to update. But now there are no errors.
After upgrading my gopls to v0.8.1, no more error.
you need to re-compile or update gopls with go1.18. If you are using Homebrew to install gopls, run brew reinstall gopls --install-from-sources.
For me, It fixed my VSCode using CMD + SHIFT + P -> Go: Install/Update Tools
I am gettiing a similar type of error when i try to run linters on my code using a pipeline.
For me, It fixed my
VSCodeusingCMD + SHIFT + P->Go: Install/Update Tools
That's my kind of fix: 3k errors to zero errors with one click!
This discussion doesn't seem relevant anymore. Closing.