|  | 
| 1 | 1 | diff --git cmd/dlv/cmds/commands.go cmd/dlv/cmds/commands.go | 
| 2 |  | -index 15df5f6..f145330 100644 | 
|  | 2 | +index b5b7662c..dcdae257 100644 | 
| 3 | 3 | --- cmd/dlv/cmds/commands.go | 
| 4 | 4 | +++ cmd/dlv/cmds/commands.go | 
| 5 |  | -@@ -46,6 +46,10 @@ var ( | 
| 6 |  | - 	apiVersion int | 
| 7 |  | - 	// acceptMulti allows multiple clients to connect to the same server | 
| 8 |  | - 	acceptMulti bool | 
| 9 |  | -+	// checkGoVersionDefault sets default for --check-go-version | 
| 10 |  | -+	checkGoVersionDefault = "true" | 
|  | 5 | +@@ -61,6 +61,8 @@ var ( | 
|  | 6 | + 	// checkLocalConnUser is true if the debugger should check that local | 
|  | 7 | + 	// connections come from the same user that started the headless server | 
|  | 8 | + 	checkLocalConnUser bool | 
| 11 | 9 | +	// checkLocalConnUserDefault sets default for --only-same-user | 
| 12 | 10 | +	checkLocalConnUserDefault = "true" | 
| 13 |  | - 	// addr is the debugging server listen address. | 
| 14 |  | - 	addr string | 
| 15 |  | - 	// initFile is the path to initialization file. | 
| 16 |  | -@@ -139,8 +143,8 @@ func New(docCall bool) *cobra.Command { | 
| 17 |  | - 	rootCommand.PersistentFlags().StringVar(&initFile, "init", "", "Init file, executed by the terminal client.") | 
| 18 |  | - 	rootCommand.PersistentFlags().StringVar(&buildFlags, "build-flags", buildFlagsDefault, "Build flags, to be passed to the compiler. For example: --build-flags=\"-tags=integration -mod=vendor -cover -v\"") | 
|  | 11 | + 	// tty is used to provide an alternate TTY for the program you wish to debug. | 
|  | 12 | + 	tty string | 
|  | 13 | + 	// disableASLR is used to disable ASLR | 
|  | 14 | +@@ -78,6 +80,8 @@ var ( | 
|  | 15 | + 	// used to compile the executable and refuse to work on incompatible | 
|  | 16 | + 	// versions. | 
|  | 17 | + 	checkGoVersion bool | 
|  | 18 | ++	// checkGoVersionDefault sets default for --check-go-version | 
|  | 19 | ++	checkGoVersionDefault = "true" | 
|  | 20 | +  | 
|  | 21 | + 	// rootCommand is the root of the command tree. | 
|  | 22 | + 	rootCommand *cobra.Command | 
|  | 23 | +@@ -158,8 +162,8 @@ func New(docCall bool) *cobra.Command { | 
|  | 24 | + 	must(rootCommand.RegisterFlagCompletionFunc("build-flags", cobra.NoFileCompletions)) | 
| 19 | 25 |  	rootCommand.PersistentFlags().StringVar(&workingDir, "wd", "", "Working directory for running the program.") | 
|  | 26 | + 	must(rootCommand.MarkPersistentFlagDirname("wd")) | 
| 20 | 27 | -	rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", true, "Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve.") | 
| 21 | 28 | -	rootCommand.PersistentFlags().BoolVarP(&checkLocalConnUser, "only-same-user", "", true, "Only connections from the same user that started this instance of Delve are allowed to connect.") | 
| 22 | 29 | +	rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", parseBool(checkGoVersionDefault), "Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve.") | 
| 23 | 30 | +	rootCommand.PersistentFlags().BoolVarP(&checkLocalConnUser, "only-same-user", "", parseBool(checkLocalConnUserDefault), "Only connections from the same user that started this instance of Delve are allowed to connect.") | 
| 24 | 31 |  	rootCommand.PersistentFlags().StringVar(&backend, "backend", "default", `Backend selection (see 'dlv help backend').`) | 
|  | 32 | + 	must(rootCommand.RegisterFlagCompletionFunc("backend", cobra.FixedCompletions([]string{"default", "native", "lldb", "rr"}, cobra.ShellCompDirectiveNoFileComp))) | 
| 25 | 33 |  	rootCommand.PersistentFlags().StringArrayVarP(&redirects, "redirect", "r", []string{}, "Specifies redirect rules for target process (see 'dlv help redirect')") | 
| 26 |  | - 	rootCommand.PersistentFlags().BoolVar(&allowNonTerminalInteractive, "allow-non-terminal-interactive", false, "Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr") | 
| 27 |  | -@@ -1020,3 +1024,14 @@ func parseRedirects(redirects []string) ([3]string, error) { | 
|  | 34 | +@@ -1250,3 +1254,14 @@ func must(err error) { | 
|  | 35 | + 		log.Fatal(err) | 
| 28 | 36 |  	} | 
| 29 |  | - 	return r, nil | 
| 30 | 37 |  } | 
| 31 | 38 | + | 
| 32 | 39 | +// parseBool parses a boolean value represented by a string, and panics if there is an error. | 
|  | 
0 commit comments