-
Notifications
You must be signed in to change notification settings - Fork 797
No ERROR reported when a wrong type given in function's variable argument in specified code #2785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Logs of gopls (server)```log [Info - 1:23:05 PM] 2023/05/26 13:23:05 go env for /data/devhome/bugtest (root /data/devhome/bugtest) (go version go version go1.20.3 linux/amd64) (valid build configuration = true) (build flags: []) GOCACHE=/root/.cache/go-build GO111MODULE=on GONOSUMDB= GOPATH=/data/go GOPRIVATE= GOSUMDB= GONOPROXY= GOROOT=/root/sdk/go1.20.3 GOPROXY= GOMOD=/data/devhome/bugtest/go.mod GOWORK= GOFLAGS= GOINSECURE= GOMODCACHE=/data/go/pkg/mod [Info - 1:23:05 PM] 2023/05/26 13:23:05 go/packages.Load #1: updating metadata for 1 packages [Info - 1:23:05 PM] 2023/05/26 13:23:05 go/packages.Load #1 [Error - 1:23:05 PM] 2023/05/26 13:23:05 tidy: diagnosing file:///data/devhome/bugtest/go.mod: err: exit status 1: stderr: go: finding module for package go.opentelemetry.io/otel/metric [Error - 1:23:05 PM] 2023/05/26 13:23:05 tidy: diagnosing file:///data/devhome/bugtest/go.mod: err: exit status 1: stderr: go: finding module for package go.opentelemetry.io/otel/metric [Error - 1:23:05 PM] 2023/05/26 13:23:05 tidy: diagnosing file:///data/devhome/bugtest/go.mod: err: exit status 1: stderr: go: finding module for package go.opentelemetry.io/otel/metric [Info - 1:23:18 PM] 2023/05/26 13:23:18 go/packages.Load #2 [Info - 1:23:18 PM] 2023/05/26 13:23:18 go/packages.Load #2: updating metadata for 55 packages [Info - 1:24:30 PM] 2023/05/26 13:24:30 background imports cache refresh starting [Info - 1:24:30 PM] 2023/05/26 13:24:30 background refresh finished after 146.719381ms [Info - 1:28:17 PM] 2023/05/26 13:28:17 background imports cache refresh starting [Info - 1:28:17 PM] 2023/05/26 13:28:17 background refresh finished after 50.45597ms [Info - 1:28:58 PM] 2023/05/26 13:28:58 background imports cache refresh starting [Info - 1:28:58 PM] 2023/05/26 13:28:58 background refresh finished after 47.214546ms [Info - 1:39:07 PM] 2023/05/26 13:39:07 background imports cache refresh starting [Info - 1:39:07 PM] 2023/05/26 13:39:07 background refresh finished after 48.461615ms [Info - 1:44:15 PM] 2023/05/26 13:44:15 background imports cache refresh starting [Info - 1:44:15 PM] 2023/05/26 13:44:15 background refresh finished after 46.101723ms [Info - 1:45:00 PM] 2023/05/26 13:45:00 background imports cache refresh starting [Info - 1:45:00 PM] 2023/05/26 13:45:00 background refresh finished after 48.175514ms [Info - 1:54:03 PM] 2023/05/26 13:54:03 background imports cache refresh starting [Info - 1:54:03 PM] 2023/05/26 13:54:03 background refresh finished after 48.145919ms [Info - 2:02:03 PM] 2023/05/26 14:02:03 background imports cache refresh starting [Info - 2:02:03 PM] 2023/05/26 14:02:03 background refresh finished after 45.840085ms [Info - 2:05:53 PM] 2023/05/26 14:05:53 background imports cache refresh starting [Info - 2:05:53 PM] 2023/05/26 14:05:53 background refresh finished after 46.027145ms [Error - 2:06:23 PM] 2023/05/26 14:06:23 no signature help: cannot find an enclosing function [Error - 2:06:23 PM] 2023/05/26 14:06:23 imports fixes: AllImportsFixes: /data/devhome/bugtest/main.go:9:1: expected declaration, found ',' (and 1 more errors) [Error - 2:06:26 PM] 2023/05/26 14:06:26 imports fixes: AllImportsFixes: /data/devhome/bugtest/main.go:9:1: expected declaration, found metric (and 1 more errors) [Error - 2:06:26 PM] 2023/05/26 14:06:26 imports fixes: AllImportsFixes: /data/devhome/bugtest/main.go:9:1: expected declaration, found metric (and 1 more errors) [Info - 2:06:59 PM] 2023/05/26 14:06:59 background imports cache refresh starting [Info - 2:06:59 PM] 2023/05/26 14:06:59 background refresh finished after 49.062313ms [Info - 2:08:33 PM] 2023/05/26 14:08:33 background imports cache refresh starting [Info - 2:08:33 PM] 2023/05/26 14:08:33 background refresh finished after 48.725928ms [Info - 2:25:51 PM] 2023/05/26 14:25:51 background imports cache refresh starting [Info - 2:25:51 PM] 2023/05/26 14:25:51 background refresh finished after 46.251641ms [Info - 2:27:17 PM] 2023/05/26 14:27:17 background imports cache refresh starting [Info - 2:27:17 PM] 2023/05/26 14:27:17 background refresh finished after 46.006942ms [Error - 2:29:34 PM] Request textDocument/definition failed. [Info - 2:29:45 PM] 2023/05/26 14:29:45 background refresh finished after 44.672486ms [Info - 2:30:26 PM] 2023/05/26 14:30:26 background imports cache refresh starting [Info - 2:30:26 PM] 2023/05/26 14:30:26 background refresh finished after 49.93638ms [Info - 2:30:53 PM] 2023/05/26 14:30:53 go/packages.Load #3 [Info - 2:30:53 PM] 2023/05/26 14:30:53 go/packages.Load #3 [Info - 2:30:53 PM] 2023/05/26 14:30:53 go/packages.Load #3: updating metadata for 1 packages [Error - 2:31:13 PM] 2023/05/26 14:31:13 imports fixes: AllImportsFixes: /data/devhome/bugtest/main.go:9:8: mixed named and unnamed parameters [Error - 2:31:14 PM] 2023/05/26 14:31:14 imports fixes: AllImportsFixes: /data/devhome/bugtest/main.go:9:8: mixed named and unnamed parameters [Info - 2:31:14 PM] 2023/05/26 14:31:14 background imports cache refresh starting [Info - 2:31:14 PM] 2023/05/26 14:31:14 background refresh finished after 50.430987ms [Info - 2:31:44 PM] 2023/05/26 14:31:44 background imports cache refresh starting [Info - 2:31:44 PM] 2023/05/26 14:31:44 background refresh finished after 49.652011ms [Info - 2:32:57 PM] 2023/05/26 14:32:57 background imports cache refresh starting [Info - 2:32:57 PM] 2023/05/26 14:32:57 background refresh finished after 48.3669ms [Info - 2:37:17 PM] 2023/05/26 14:37:17 background imports cache refresh starting [Info - 2:37:17 PM] 2023/05/26 14:37:17 background refresh finished after 48.041176ms [Info - 2:49:40 PM] 2023/05/26 14:49:40 background imports cache refresh starting [Info - 2:49:40 PM] 2023/05/26 14:49:40 background refresh finished after 48.554291ms
|
A more verbose log using the code above after restart language server: package main
import "go.opentelemetry.io/otel/metric"
type MeterProvider interface {
Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter
}
type MyProvider interface {
Reproduce(xxx string, opts ...metric.MeterOption) metric.Meter
}
type VariableFuncInterface interface {
Func(xxx string, opts ...int) string
}
func main() {
var x interface{} = 1
x.(MeterProvider).Meter("test", "test")
x.(metric.MeterProvider).Meter("test", 123)
x.(MyProvider).Reproduce("test", 123)
// bug --^---
// error shoud be reported here
x.(VariableFuncInterface).Func("", "")
// not produced here
} Log
|
Hi, this should be fixed in [email protected]. Could you please try upgrading gopls and confirm?
Thank you. |
Thanks for reporting this bug and providing a reproducible test case. I confirm that the bug exists at v0.11.0, and also that it is fixed by v0.12.0, so I'm going to mark it as fixed. |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.go version go1.20.3 linux/amd64
gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
Describe the bug
A clear and concise description of what the bug:
A clear and concise description of what you expected to happen:
cannot use "test" (constant of type string) as MeterOption value in argument to x.(MeterProvider).Meter: string does not implement MeterOption (missing method applyMeter)
with hintcomplier(InvalidIfaceAssign)
I know it is really looks odd. But it does. And I asked my friends to reproduce with my code. All of them reproduced.
Steps to reproduce the behavior:
main.go
.Other ways to reproduce the bug:
Code
Note:
go.opentelemetry.io/otel/metric
package. Whatever the function is, the point is that choose a variadic function and call it. For me, I tried to callMeter()
func to ametric.MeterProvider
and callFloat64Histogram
themetric.Meter
. All of them can produce the bug.Code & Screenshot
Screenshots or recordings
The text was updated successfully, but these errors were encountered: