Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Delve shows difference between nil and zero-len/zero-cap slice, Go-extension does not #2813

Closed
cameronelliott opened this issue Oct 6, 2019 · 5 comments · Fixed by #2839
Closed

Comments

@cameronelliott
Copy link

Even though delve is showing the difference between nil slices, and zero-len/zero-cap slices, the VSCode interface to the debugger is not doing so, and I appear to have the recent 0.11.7 release.
I also only have a single dlv.exe on my system of ver 1.2.0

Delve showning nil vs zero-len/zero-cap slice
image

VScode Go extension not showing the difference
image

Test code:

package main


import "fmt"

func main() {
	var x []string
	y:=[]string{}
	fmt.Println(x,y)

}
@ramya-rao-a
Copy link
Contributor

Thanks for reporting @Cameron-elliott

@derekparker, @aarzilli,
What field in the Variable can the debug client look at to determine the above difference?

@aarzilli
Copy link

The Base field will be zero for nil slices.

@ramya-rao-a
Copy link
Contributor

Thanks @aarzilli!

PRs are welcome to make this change

Code Pointers:

@ramya-rao-a
Copy link
Contributor

Please try the latest beta version of this extension has the fix for this

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Nov 5, 2019

The latest update to this extension (0.11.8) has the fix for this.

Thanks for reporting @Cameron-elliott and @karthikraobr for the fix

Happy Coding!

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants