Source File
package.go
Belonging Package
golang.org/x/pkgsite/internal/fetch
package fetch
import (
)
= moduleVersionDir(, ) + "/"
= &godoc.ModuleInfo{
ModulePath: ,
ResolvedVersion: ,
ModulePackages: make(map[string]bool),
}
= make(map[string]bool)
= []*internal.PackageVersionState{}
)
for , := range .File {
continue
}
continue
}
continue
if := module.CheckImportPath(); != nil {
[] = true
= append(, &internal.PackageVersionState{
ModulePath: ,
PackagePath: ,
Version: ,
Status: derrors.ToStatus(derrors.PackageBadImportPath),
Error: .Error(),
})
continue
}
if .UncompressedSize64 > MaxFileSize {
[] = true
:= derrors.ToStatus(derrors.PackageMaxFileSizeLimitExceeded)
:= fmt.Sprintf("Unable to process %s: file size %d exceeds max limit %d",
.Name, .UncompressedSize64, MaxFileSize)
= append(, &internal.PackageVersionState{
ModulePath: ,
PackagePath: ,
Version: ,
Status: ,
Error: ,
})
continue
}
[] = append([], )
if len() > maxPackagesPerModule {
return nil, nil, fmt.Errorf("%d packages found in %q; exceeds limit %d for maxPackagePerModule", len(), , maxPackagesPerModule)
}
}
for := range {
.ModulePackages[path.Join(, )] = true
}
var []*goPackage
for , := range {
log.Infof(, "Skipping %q because it is incomplete", )
continue
}
var (
error
string
)
, := loadPackage(, , , , )
if := (*BadPackageError)(nil); errors.As(, &) {
[] = true
= derrors.PackageInvalidContents
= .Error()
} else if != nil {
return nil, nil, fmt.Errorf("unexpected error loading package: %v", )
}
var string
[] = true
= derrors.PackageBuildContextNotSupported
}
= path.Join(, )
} else {
if errors.Is(.err, godoc.ErrTooLarge) {
= derrors.PackageDocumentationHTMLTooLarge
= .err.Error()
return nil, nil, fmt.Errorf("bad package error for %s: %v", .path, .err)
}
if != nil { // should only be nil for tests
, := .PackageInfo()
.isRedistributable =
for , := range {
.licenseMeta = append(.licenseMeta, .Metadata)
}
}
= append(, )
= .path
}
= append(, &internal.PackageVersionState{
ModulePath: ,
PackagePath: ,
Version: ,
Status: derrors.ToStatus(),
Error: ,
})
}
if len() == 0 {
return nil, , ErrModuleContainsNoPackages
}
return , , nil
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |