diff --git a/godoc/parser.go b/godoc/parser.go index 4e644d6fc0..c864a0a34a 100644 --- a/godoc/parser.go +++ b/godoc/parser.go @@ -53,7 +53,7 @@ func (c *Corpus) parseFile(fset *token.FileSet, filename string, mode parser.Mod } // Temporary ad-hoc fix for issue 5247. - // TODO(gri) Remove this in favor of a better fix, eventually (see issue 7702). + // TODO(gri,dmitshur) Remove this in favor of a better fix, eventually (see issue 32092). replaceLinePrefixCommentsWithBlankLine(src) return parser.ParseFile(fset, filename, src, mode) diff --git a/godoc/server_test.go b/godoc/server_test.go index 656e5f5874..a7ed5142f5 100644 --- a/godoc/server_test.go +++ b/godoc/server_test.go @@ -46,3 +46,24 @@ package main`})) t.Error("pInfo.FSet = nil; want non-nil.") } } + +func TestIssue5247(t *testing.T) { + const packagePath = "example.com/p" + c := NewCorpus(mapfs.New(map[string]string{ + "src/" + packagePath + "/p.go": `package p + +//line notgen.go:3 +// F doc //line 1 should appear +// line 2 should appear +func F() +//line foo.go:100`})) // No newline at end to check corner cases. + + srv := &handlerServer{ + p: &Presentation{Corpus: c}, + c: c, + } + pInfo := srv.GetPageInfo("/src/"+packagePath, packagePath, 0, "linux", "amd64") + if got, want := pInfo.PDoc.Funcs[0].Doc, "F doc //line 1 should appear\nline 2 should appear\n"; got != want { + t.Errorf("pInfo.PDoc.Funcs[0].Doc = %q; want %q", got, want) + } +}