microsoft / vscode-go

An extension for VS Code which provides support for the Go language. We have moved to https://github.com/golang/vscode-go
Other
5.93k stars 648 forks source link

Improve Error Messaging. When a pointer based type has all the interface methods defined, the messaging in the editor is incorrect. #3210

Closed artivilla closed 4 years ago

artivilla commented 4 years ago

What version of Go, VS Code & VS Code Go extension are you using?

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file. Share all the settings with the go. or ["go"] prefixes.

    "go.autocompleteUnimportedPackages": true,
    "go.lintFlags": [
        "--fast"
    ],
    "go.lintOnSave": "file",
    "go.lintTool": "golint",
    "go.useLanguageServer": true,

Describe the bug

Improve Error Messaging. When a pointer based type has all the interface methods defined, the messaging in the editor is incorrect.

Run the following error in the shared playground: https://play.golang.org/p/l7YETLSrYeL

Expected Error (shown in playground):

./prog.go:21:6: cannot use SimpleReader literal (type SimpleReader) as type io.ReadCloser in assignment: SimpleReader does not implement io.ReadCloser (Close method has pointer receiver)

Actual Error from VS Nightly Code Editor: image

stamblerre commented 4 years ago

This is actually an issue in the Go standard library, and it will be fixed in Go 1.15 (see https://golang.org/cl/229801). If you're interested in trying it out now, you can download Go from source (https://golang.org/doc/install/source) and rebuild gopls with it. Otherwise, this fix will be released approximately 3 months from now (in keeping with Go's 6 month release cycle).