From 1d6eb238206fcf8815d88981527ef176851afd7a Mon Sep 17 00:00:00 2001 From: Tyler Bui-Palsulich <26876514+tbpg@users.noreply.github.com> Date: Fri, 22 Jan 2021 12:50:03 -0500 Subject: [PATCH] fix(internal/godocfx): add TOC element for module root package (#3599) --- internal/godocfx/parse.go | 9 ++++++++- internal/godocfx/testdata/golden/toc.yml | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/godocfx/parse.go b/internal/godocfx/parse.go index fb44d93e2d1..64628591e0d 100644 --- a/internal/godocfx/parse.go +++ b/internal/godocfx/parse.go @@ -339,9 +339,16 @@ func buildTOC(mod string, pis []pkgInfo, extraFiles []extraFile) tableOfContents toc := tableOfContents{} modTOC := &tocItem{ - UID: mod, // Assume the module root has a package. + UID: mod, Name: mod, } + + // Assume the module root has a package. + modTOC.addItem(&tocItem{ + UID: mod, + Name: mod, + }) + for _, ef := range extraFiles { modTOC.addItem(&tocItem{ Href: ef.dstRelativePath, diff --git a/internal/godocfx/testdata/golden/toc.yml b/internal/godocfx/testdata/golden/toc.yml index 4e31bd65dbb..051e663c432 100644 --- a/internal/godocfx/testdata/golden/toc.yml +++ b/internal/godocfx/testdata/golden/toc.yml @@ -2,5 +2,7 @@ - uid: cloud.google.com/go/storage name: cloud.google.com/go/storage items: + - uid: cloud.google.com/go/storage + name: cloud.google.com/go/storage - name: README href: pkg-readme.md