cmd: Fix trace bug when no package specified

Fix a bug where the regexp would be used as a package string
incorrectly. This would manifest when trying to execute the trace
subcommand as `dlv trace <regexp>` without specifying a package
identifier. The `<regexp>` would be passed to the Go build command
causing an error.
This commit is contained in:
Derek Parker 2018-10-17 14:25:31 -07:00 committed by Alessandro Arzilli
parent b5cf584564
commit c920630082

@ -339,6 +339,7 @@ func traceCmd(cmd *cobra.Command, args []string) {
var dlvArgsLen = len(dlvArgs)
if dlvArgsLen == 1 {
regexp = args[0]
dlvArgs = dlvArgs[0:0]
} else if dlvArgsLen >= 2 {
regexp = dlvArgs[dlvArgsLen-1]
dlvArgs = dlvArgs[:dlvArgsLen-1]