Skip to content

Improved Delve support for Go 1.9 #2901

@aarzilli

Description

@aarzilli

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions