fix(11.1-07): require built, run src= code; case-sensitive go doc; parse command forms
- .go src= targets must be in the default build and reached from a Test or an Example with output - go doc -c makes the identifier fallback case-sensitive - commandWord parses env prefixes, flags, go run and bin/ forms
This commit is contained in:
@@ -284,10 +284,10 @@ func isUpper(s string) bool {
|
||||
// optionally followed by one ".Member".
|
||||
var goDocIdent = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?$`)
|
||||
|
||||
// goDoc is the fallback for an index miss: `go doc ./<dir> <query>` run in
|
||||
// the repository root, so a declaration the index does not model still
|
||||
// counts. It runs without a shell, on an argument list whose query matches
|
||||
// goDocIdent.
|
||||
// goDoc is the fallback for an index miss: `go doc -c ./<dir> <query>`
|
||||
// run in the repository root, so a declaration the index does not model
|
||||
// still counts. -c makes the match case-sensitive. It runs without a
|
||||
// shell, on an argument list whose query matches goDocIdent.
|
||||
func (idx *identIndex) goDoc(dir, query string) bool {
|
||||
if !goDocIdent.MatchString(query) {
|
||||
return false
|
||||
@@ -298,7 +298,7 @@ func (idx *identIndex) goDoc(dir, query string) bool {
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, "go", "doc", "./"+dir, query)
|
||||
cmd := exec.CommandContext(ctx, "go", "doc", "-c", "./"+dir, query)
|
||||
cmd.Dir = idx.root
|
||||
cmd.Stdout, cmd.Stderr = nil, nil
|
||||
ok := cmd.Run() == nil
|
||||
|
||||
Reference in New Issue
Block a user