Also works now together with -html, as in:
godoc -html -q Sin
for an html result.
Fixes #2435.
R=iant
CC=golang-dev
https://golang.org/cl/
5375074
"io"
"log"
"net/http"
+ "net/url"
"os"
"path"
"path/filepath"
return
}
+// remoteSearchURL returns the search URL for a given query as needed by
+// remoteSearch. If html is set, an html result is requested; otherwise
+// the result is in textual form.
+// Adjust this function as necessary if modeNames or FormValue parameters
+// change.
+func remoteSearchURL(query string, html bool) string {
+ s := "/search?m=text&q="
+ if html {
+ s = "/search?q="
+ }
+ return s + url.QueryEscape(query)
+}
+
type PageInfo struct {
Dirname string // directory containing the package
PList []string // list of package names found
"log"
"net/http"
_ "net/http/pprof" // to serve /debug/pprof/*
- "net/url"
"os"
"path"
"path/filepath"
}
func remoteSearch(query string) (res *http.Response, err error) {
- search := "/search?f=text&q=" + url.QueryEscape(query)
-
// list of addresses to try
var addrs []string
if *serverAddr != "" {
}
// remote search
+ search := remoteSearchURL(query, *html)
for _, addr := range addrs {
url := "http://" + addr + search
res, err = http.Get(url)