Skip to content
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

Support conversion to interface type in function calls #1575

Open
dlsniper opened this issue Jun 7, 2019 · 3 comments
Open

Support conversion to interface type in function calls #1575

dlsniper opened this issue Jun 7, 2019 · 3 comments

Comments

@dlsniper
Copy link
Contributor

dlsniper commented Jun 7, 2019

  1. What version of Delve are you using (dlv version)?
    72fae3c
  2. What version of Go are you using? (go version)?
    Go 1.13 (ac8dbe7747971007d58eb39e2e7e615cf9f04493)
  3. What operating system and processor architecture are you using?
    Win 10
  4. What did you do?
    Run the following application with a breakpoint on line 8
package main

import "fmt"

func main() {
	colors := map[string]string{"key":"value"}
	color, ok := colors["ke"]
	if !ok {
		// handle missing map key case here
	}
	fmt.Println(color)
}

Invoke the following delve command:

call fmt.Println(color)

or

call fmt.Println(ok)
  1. What did you expect to see?
    I would expect the debugger show the result of the function call and print it on the output
  2. What did you see instead?
Command failed: can not convert value of type string to []interface {}

or

Command failed: can not convert value of type boolean to []interface {}
@chainhelen
Copy link
Contributor

chainhelen commented Mar 5, 2020

I found the same issue yesterday. In fact, not support variadic first here, then interface type.

@icholy
Copy link
Contributor

icholy commented Mar 8, 2021

I wonder if there's a way to do this without injecting calls to runtime·convT2E in the target.

@zuozhiw
Copy link

zuozhiw commented Jun 4, 2024

Bump on this issue. I find it really inconvenient to use. In normal code, this would work perfectly fine, but not in a debugger. Often, the variable is a concrete type rather than an interface type, and we need to pass it to a more general function, like printing. It would be great to have an update or resolution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants