|
| 1 | +diff --git cmd/dlv/cmds/commands.go cmd/dlv/cmds/commands.go |
| 2 | +index 15df5f6..f145330 100644 |
| 3 | +--- cmd/dlv/cmds/commands.go |
| 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" |
| 11 | ++ // checkLocalConnUserDefault sets default for --only-same-user |
| 12 | ++ 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\"") |
| 19 | + rootCommand.PersistentFlags().StringVar(&workingDir, "wd", "", "Working directory for running the program.") |
| 20 | +- 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 | +- 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 | ++ 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 | ++ 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 | + rootCommand.PersistentFlags().StringVar(&backend, "backend", "default", `Backend selection (see 'dlv help backend').`) |
| 25 | + 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) { |
| 28 | + } |
| 29 | + return r, nil |
| 30 | + } |
| 31 | ++ |
| 32 | ++// parseBool parses a boolean value represented by a string, and panics if there is an error. |
| 33 | ++// It is intended for boolean build-time constants that are set with 'go build -ldflags=-X xxx=bool' |
| 34 | ++// and should only be a valid value. |
| 35 | ++func parseBool(value string) bool { |
| 36 | ++ b, err := strconv.ParseBool(value) |
| 37 | ++ if err != nil { |
| 38 | ++ panic(err) |
| 39 | ++ } |
| 40 | ++ return b |
| 41 | ++} |
0 commit comments