delve icon indicating copy to clipboard operation
delve copied to clipboard

Duplicate / in paths are not stripped

Open nicoche opened this issue 2 years ago • 1 comments

Hi!

First, thanks for working on delve.

This issue is probably in between a bug and a feature request. Basically, it happens to me often to copy-paste some path to a file where I want to put a breakpoint in and sometimes, a duplicate / finds its way in there.

With most unix tools, duplicate paths are stripped (e.g. cd /tmp//test == cd /tmp/test). GDB and Delve do not do that out of the box.

What do you think, would it be something you are willing to add to delve? If yes, how easy would it be to implement?


  1. What version of Delve are you using (dlv version)?
$ dlv version
Delve Debugger
Version: 1.7.1
Build: $Id: 3bde2354aafb5a4043fd59838842c4cd4a8b6f0b $
  1. What version of Go are you using? (go version)?
$ go version
go version go1.17.2 darwin/amd64
  1. What operating system and processor architecture are you using?
$ uname -a
Darwin Nicolass-MBP 21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:34:37 PST 2022; root:xnu-8020.101.4~2/RELEASE_X86_64 x86_64
  1. What did you do?
dlv debug main.go
Type 'help' for list of commands.
(dlv) funcs SomeFunc
example.com/m/pkg/accounts.SomeFunction
(dlv) break example.com/m/pkg//accounts.SomeFunction
Command failed: location "example.com/m/pkg//accounts.SomeFunction" not found
(dlv) break example.com/m/pkg/accounts.SomeFunction
Breakpoint 1 set at 0x10abc06 for example.com/m/pkg/accounts.SomeFunction() ./pkg/accounts/accounts.go:7
  1. What did you expect to see?
$ dlv debug main.go
Type 'help' for list of commands.
(dlv) funcs SomeFunc
example.com/m/pkg/accounts.SomeFunction
(dlv) break example.com/m/pkg//accounts.SomeFunction
Command failed: location "example.com/m/pkg//accounts.SomeFunction" not found
(dlv) break example.com/m/pkg/accounts.SomeFunction
Breakpoint 1 set at 0x10abc06 for example.com/m/pkg/accounts.SomeFunction() ./pkg/accounts/accounts.go:7
  1. What did you see instead?
(dlv) funcs SomeFunc
example.com/m/pkg/accounts.SomeFunction
(dlv) break example.com/m/pkg//accounts.SomeFunction
Breakpoint 1 set at 0x10abc06 for example.com/m/pkg/accounts.SomeFunction() ./pkg/accounts/accounts.go:7

nicoche avatar Mar 21 '22 22:03 nicoche

I think doing this on functions names is weird, since they aren't even really paths.

aarzilli avatar Mar 22 '22 17:03 aarzilli