Copyright 2019 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package frontend

import (
	
	
	
	
	

	
	
	
	
	
	
	
)

func ( context.Context,  *internal.Unit,  *godoc.Package,
	 map[string]string) ( *dochtml.Parts,  error) {
	defer derrors.Wrap(&, "renderDocParts")
	defer middleware.ElapsedStat(, "renderDocParts")()

	 := &godoc.ModuleInfo{
		ModulePath:      .ModulePath,
		ResolvedVersion: .Version,
		ModulePackages:  nil, // will be provided by docPkg
	}
	var  string
	if .ModulePath == stdlib.ModulePath {
		 = .Path
	} else if .Path != .ModulePath {
		 = .Path[len(.ModulePath)+1:]
	}
	return .Render(, , .SourceInfo, , )
}
sourceFiles returns the .go files for a package.
func ( *internal.Unit,  *godoc.Package) []*File {
	var  []*File
	for ,  := range .Files {
		if strings.HasSuffix(.Name, "_test.go") {
			continue
		}
		 = append(, &File{
			Name: .Name,
			URL:  .SourceInfo.FileURL(path.Join(internal.Suffix(.Path, .ModulePath), .Name)),
		})
	}
	sort.Slice(, func(,  int) bool { return [].Name < [].Name })
	return 
}
fileSource returns the original filepath in the module zip where the given filePath can be found. For std, the corresponding URL in go.google.source.com/go is returned.
func (, ,  string) string {
	if  != stdlib.ModulePath {
		return fmt.Sprintf("%s@%s/%s", , , )
	}

	 := strings.TrimPrefix(stdlib.GoRepoURL, "https://")
	,  := stdlib.TagForVersion()
This should never happen unless there is a bug in stdlib.TagForVersion. In which case, fallback to the default zipFilePath.
		log.Errorf(context.TODO(), "fileSource: %v", )
		return fmt.Sprintf("%s/+/refs/heads/master/%s", , )
	}
	return fmt.Sprintf("%s/+/refs/tags/%s/%s", , , )