func legacyCreatePackage(pkg *internal.LegacyPackage, mi *internal.ModuleInfo, latestRequested bool) (_ *Package, err error) {
	defer derrors.Wrap(&err, "legacyCreatePackage(%v, %v)", pkg, mi)

	if pkg == nil || mi == nil {
		return nil, fmt.Errorf("package and version info must not be nil")
	}

	var modLicenses []*licenses.Metadata
	for _, lm := range pkg.Licenses {
		if path.Dir(lm.FilePath) == "." {
			modLicenses = append(modLicenses, lm)
		}
	}

	m := createModule(mi, modLicenses, latestRequested)
	urlVersion := m.LinkVersion
	if latestRequested {
		urlVersion = internal.LatestVersion
	}
	return &Package{
		Path:              pkg.Path,
		Synopsis:          pkg.Synopsis,
		IsRedistributable: pkg.IsRedistributable,
		Licenses:          transformLicenseMetadata(pkg.Licenses),
		Module:            *m,
		URL:               constructPackageURL(pkg.Path, mi.ModulePath, urlVersion),
		LatestURL:         constructPackageURL(pkg.Path, mi.ModulePath, middleware.LatestVersionPlaceholder),
	}, nil
}
// legacyCreatePackage returns a *Package based on the fields of the specified
// internal package and version info.
//
// latestRequested indicates whether the user requested the latest
// version of the package. If so, the returned Package.URL will have the
// structure /<path> instead of /<path>@<version>.
legacyCreatePackage returns a *Package based on the fields of the specified
internal package and version info.

latestRequested indicates whether the user requested the latest
version of the package. If so, the returned Package.URL will have the
structure / instead of /@.
// legacyCreatePackage returns a * Package based on the fields of the specified // internal package and version info . // // latestRequested indicates whether the user requested the latest // version of the package . If so the returned Package . URL will have the // structure / <path > instead of / <path > @<version > .
func legacyCreatePackage(pkg *internal.LegacyPackage, mi *internal.ModuleInfo, latestRequested bool) (_ *Package, err error) {
	defer derrors.Wrap(&err, "legacyCreatePackage(%v, %v)", pkg, mi)
	if pkg == nil || mi == nil {
		return nil, fmt.Errorf("package and version info must not be nil")
	}
	var modLicenses []*licenses.Metadata
	for _, lm := range pkg.Licenses {
		if path.Dir(lm.FilePath) == "." {
			modLicenses = append(modLicenses, lm)
		}
	}
	m := createModule(mi, modLicenses, latestRequested)
	urlVersion := m.LinkVersion
	if latestRequested {
		urlVersion = internal.LatestVersion
	}
	return &Package{
		Path:              pkg.Path,
		Synopsis:          pkg.Synopsis,
		IsRedistributable: pkg.IsRedistributable,
		Licenses:          transformLicenseMetadata(pkg.Licenses),
		Module:            *m,
		URL:               constructPackageURL(pkg.Path, mi.ModulePath, urlVersion),
		LatestURL:         constructPackageURL(pkg.Path, mi.ModulePath, middleware.LatestVersionPlaceholder),
	}, nil
}
func legacyCreatePackage ( pkg * internal . LegacyPackage , mi * internal . ModuleInfo , latestRequested bool ) ( _ * Package , err error ) { defer derrors . Wrap ( & err , " " , pkg , mi ) if pkg == nil || mi == nil { return nil , fmt . Errorf ( " " ) } var modLicenses [ ] * licenses . Metadata for _ , lm := range pkg . Licenses { if path . Dir ( lm . FilePath ) == " " { modLicenses = append ( modLicenses , lm ) } } m := createModule ( mi , modLicenses , latestRequested ) urlVersion := m . LinkVersion if latestRequested { urlVersion = internal . LatestVersion } return & Package { Path : pkg . Path , Synopsis : pkg . Synopsis , IsRedistributable : pkg . IsRedistributable , Licenses : transformLicenseMetadata ( pkg . Licenses ) , Module : * m , URL : constructPackageURL ( pkg . Path , mi . ModulePath , urlVersion ) , LatestURL : constructPackageURL ( pkg . Path , mi . ModulePath , middleware . LatestVersionPlaceholder ) , } , nil }
legacyCreatePackage returns a *Package based on the fields of the specified
internal package and version info.
legacyCreatePackage returns a * Package based on the fields of the specified internal package and version info .