Skip to content

Commit

Permalink
internal/godoc: rename RenderPartsFromUnit
Browse files Browse the repository at this point in the history
For golang/go#40850

Change-Id: I82b7b3cd683eedacc6e49e66bca5b5a2f5a19ae8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/312430
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
  • Loading branch information
jba committed Apr 22, 2021
1 parent 762b7a6 commit 802d4e6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/fetch/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func validateDocumentationHTML(t *testing.T, got *internal.Module, want map[stri
ctx := context.Background()
for _, u := range got.Units {
if wantStrings := want[u.Path]; wantStrings != nil {
parts, err := godoc.RenderPartsFromUnit(ctx, u)
parts, err := godoc.RenderFromUnit(ctx, u)
if err != nil && !errors.Is(err, godoc.ErrTooLarge) {
t.Fatal(err)
}
Expand Down
10 changes: 3 additions & 7 deletions internal/godoc/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ const (
// It is a variable for testing.
var MaxDocumentationHTML = 20 * megabyte

// A Renderer renders documentation for a Package.
type Renderer struct {
}

// DocInfo returns information extracted from the package's documentation.
// This destroys p's AST; do not call any methods of p after it returns.
func (p *Package) DocInfo(ctx context.Context, innerPath string, sourceInfo *source.Info, modInfo *ModuleInfo) (
Expand Down Expand Up @@ -207,9 +203,9 @@ func (p *Package) Render(ctx context.Context, innerPath string,
return parts, nil
}

// RenderPartsFromUnit is a convenience function that first decodes the source
// in the unit, which must exist, and then calls RenderParts.
func RenderPartsFromUnit(ctx context.Context, u *internal.Unit) (_ *dochtml.Parts, err error) {
// RenderFromUnit is a convenience function that first decodes the source
// in the unit, which must exist, and then calls Render.
func RenderFromUnit(ctx context.Context, u *internal.Unit) (_ *dochtml.Parts, err error) {
docPkg, err := DecodePackage(u.Documentation[0].Source)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion internal/worker/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func TestFetchAndUpdateState(t *testing.T) {
return
}
if gotPkg.Documentation != nil {
parts, err := godoc.RenderPartsFromUnit(ctx, gotPkg)
parts, err := godoc.RenderFromUnit(ctx, gotPkg)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 802d4e6

Please sign in to comment.