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

Improved Delve support for Go 1.9 #2901

Open
aarzilli opened this issue Aug 2, 2017 · 2 comments
Open

Improved Delve support for Go 1.9 #2901

aarzilli opened this issue Aug 2, 2017 · 2 comments

Comments

@aarzilli
Copy link

aarzilli commented Aug 2, 2017

Yesterday we merged support for go1.9 into Delve, users that use delve with go1.9 will need to update. There are no backwards incompatible changes so this frontend should keep working normally with the updated delve.

However there are two things that delve frontends can do for a better debugging experience with go 1.9:

  1. If you are building the binaries passed to delve instead of letting delve call the compile make sure to pass -a to go build if the version of go is 1.9. If -a isn't passed the compiler will pick up cached packages that might contain optimized code. This will probably change again in 1.10 when the go tool is expected to become intelligent enough to not pick up cached optimized artifacts for a non-optimized build.

  2. We have added a new Flags field to Variable values returned by API call ListLocalVars. It's a bit field. Variables that are in scope but shadowed by another variable of the same name will have the VariableShadowed flag set.

For example:

func testfunc() {
	for i := 0; i < 10; i++ {
		for i := 0; i < 10; i++ {
			fmt.Println(i) // <- debugger is stopped here
		}
	}
}

In this situation ListLocalVars will return two variables, both named i. The first one of those (which is the one that belongs to the outer for loop) will have the VariableShadowed flag set, the other one won't

Variables that have the VariableShadowed flag set should be either omitted from the locals view or shown in a distinct way.

@dlsniper
Copy link
Member

dlsniper commented Aug 2, 2017

Hi @aarzilli, Thank you so much for the ticket. I've opened this against Gogland: https://youtrack.jetbrains.com/issue/GO-4249

Thank you for the hard work on this.

@dlsniper
Copy link
Member

This was integrated in Gogland. I'll keep this open in case someone from the community wants to pick this up.

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

No branches or pull requests

2 participants