mirror of
https://github.com/golang/go
synced 2024-11-18 07:04:52 -07:00
godoc,blog: perform minor cleanup
- Remove a stray comment which was no longer needed. The accompanying issue golang.org/issue/7524 was discussed and closed. - Combine 2 if conditions into a single if-else because length of a slice can never be negative. - Remove http links from golangOrgAbsLinkReplacer now that all links have been changed to https in the blog articles. Change-Id: I2fe2ec245b580a91760c9331e9626b367f1b6740 Reviewed-on: https://go-review.googlesource.com/107155 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
8723cc7387
commit
327197e6b0
@ -27,11 +27,8 @@ import (
|
||||
var (
|
||||
validJSONPFunc = regexp.MustCompile(`(?i)^[a-z_][a-z0-9_.]*$`)
|
||||
// used to serve relative paths when ServeLocalLinks is enabled.
|
||||
// TODO(agnivade): change blog article links to all have https.
|
||||
golangOrgAbsLinkReplacer = strings.NewReplacer(
|
||||
`href="http://golang.org/pkg`, `href="/pkg`,
|
||||
`href="https://golang.org/pkg`, `href="/pkg`,
|
||||
`href="http://golang.org/cmd`, `href="/cmd`,
|
||||
`href="https://golang.org/cmd`, `href="/cmd`,
|
||||
)
|
||||
)
|
||||
|
@ -15,10 +15,10 @@ func TestLinkRewrite(t *testing.T) {
|
||||
output string
|
||||
}{
|
||||
{
|
||||
`For instance, the <a href="http://golang.org/pkg/bytes/" target="_blank">bytes package</a> from the standard library exports the <code>Buffer</code> type.`,
|
||||
`For instance, the <a href="https://golang.org/pkg/bytes/" target="_blank">bytes package</a> from the standard library exports the <code>Buffer</code> type.`,
|
||||
`For instance, the <a href="/pkg/bytes/" target="_blank">bytes package</a> from the standard library exports the <code>Buffer</code> type.`},
|
||||
{
|
||||
`(The <a href="http://golang.org/cmd/gofmt/" target="_blank">gofmt command</a> has a <code>-r</code> flag that provides a syntax-aware search and replace, making large-scale refactoring easier.)`,
|
||||
`(The <a href="https://golang.org/cmd/gofmt/" target="_blank">gofmt command</a> has a <code>-r</code> flag that provides a syntax-aware search and replace, making large-scale refactoring easier.)`,
|
||||
`(The <a href="/cmd/gofmt/" target="_blank">gofmt command</a> has a <code>-r</code> flag that provides a syntax-aware search and replace, making large-scale refactoring easier.)`,
|
||||
},
|
||||
{
|
||||
|
@ -1532,7 +1532,6 @@ func (c *Corpus) RunIndexer() {
|
||||
}
|
||||
|
||||
// Repeatedly update the package directory tree and index.
|
||||
// TODO(bgarcia): Use fsnotify to only update when notified of a filesystem change.
|
||||
for {
|
||||
c.initFSTree()
|
||||
c.UpdateIndex()
|
||||
|
@ -113,10 +113,7 @@ func (h *handlerServer) GetPageInfo(abspath, relpath string, mode PageInfoMode,
|
||||
// documentation (historic).
|
||||
pkgname = "main" // assume package main since pkginfo.Name == ""
|
||||
pkgfiles = pkginfo.IgnoredGoFiles
|
||||
}
|
||||
|
||||
// get package information, if any
|
||||
if len(pkgfiles) > 0 {
|
||||
} else {
|
||||
// build package AST
|
||||
fset := token.NewFileSet()
|
||||
files, err := h.c.parseFiles(fset, relpath, abspath, pkgfiles)
|
||||
|
Loading…
Reference in New Issue
Block a user