Skip to content

Commit

Permalink
terminal: remove leftover GOPATH references (#3117)
Browse files Browse the repository at this point in the history
Remove leftover references to $GOPATH in documentation, change script
that generates markdown documentation to look for substrings that start
with "Documentation/" instead.
  • Loading branch information
aarzilli authored Aug 30, 2022
1 parent 5d6b31a commit b19d67c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Documentation/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Set breakpoint condition.

Specifies that the breakpoint, tracepoint or watchpoint should break only if the boolean expression is true.

See Documentation/cli/expr.md for a description of supported expressions.
See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions.

With the -hitcount option a condition on the breakpoint hit count can be set, the following operators are supported

Expand Down Expand Up @@ -511,7 +511,7 @@ Evaluate an expression.

[goroutine <n>] [frame <m>] print [%format] <expression>

See Documentation/cli/expr.md for a description of supported expressions.
See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions.

The optional format argument is a format specifier, like the ones used by the fmt package. For example "print %x v" will print v as an hexadecimal number.

Expand All @@ -526,7 +526,7 @@ Print contents of CPU registers.

regs [-a]

Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See Documentation/cli/expr.md.
Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See [Documentation/cli/expr.md.](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md.)


## restart
Expand Down Expand Up @@ -569,7 +569,7 @@ Changes the value of a variable.

[goroutine <n>] [frame <m>] set <variable> = <value>

See Documentation/cli/expr.md for a description of supported expressions. Only numerical variables and pointers can be changed.
See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions. Only numerical variables and pointers can be changed.


## source
Expand Down
6 changes: 3 additions & 3 deletions pkg/terminal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ Type "help" followed by the name of a command for more information about it.`},
break [name] [locspec]
See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a breakpoint will be set on the current line.
See Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a breakpoint will be set on the current line.
See also: "help on", "help cond" and "help clear"`},
{aliases: []string{"trace", "t"}, group: breakCmds, cmdFn: tracepoint, allowedPrefixes: onPrefix, helpMsg: `Set tracepoint.
trace [name] [locspec]
A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a tracepoint will be set on the current line.
A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See Documentation/cli/locspec.md for the syntax of locspec. If locspec is omitted a tracepoint will be set on the current line.
See also: "help on", "help cond" and "help clear"`},
{aliases: []string{"watch"}, group: breakCmds, cmdFn: watchpoint, helpMsg: `Set watchpoint.
Expand Down Expand Up @@ -428,7 +428,7 @@ Executes the specified command (print, args, locals) in the context of the n-th
source <path>
If path ends with the .star extension it will be interpreted as a starlark script. See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/starlark.md for the syntax.
If path ends with the .star extension it will be interpreted as a starlark script. See Documentation/cli/starlark.md for the syntax.
If path is a single '-' character an interactive starlark interpreter will start instead. Type 'exit' to exit.`},
{aliases: []string{"disassemble", "disass"}, cmdFn: disassCommand, helpMsg: `Disassembler.
Expand Down
14 changes: 11 additions & 3 deletions pkg/terminal/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@ import (
)

func replaceDocPath(s string) string {
const docpath = "$GOPATH/src/github.com/go-delve/delve/"
const docpath = "Documentation/"

i0 := 0

for {
start := strings.Index(s, docpath)
start := strings.Index(s[i0:], docpath)
if start < 0 {
return s
}
start += i0
if start-1 >= 0 && s[start-1] != ' ' {
i0 = start + len(docpath) + 1
continue
}
var end int
for end = start + len(docpath); end < len(s); end++ {
if s[end] == ' ' {
break
}
}

text := s[start+len(docpath) : end]
text := s[start:end]
s = s[:start] + fmt.Sprintf("[%s](//github.com/go-delve/delve/tree/master/%s)", text, text) + s[end:]
i0 = end + 1
}
}

Expand Down

0 comments on commit b19d67c

Please sign in to comment.