swh.loader.package.golang.loader module#

class swh.loader.package.golang.loader.GolangPackageInfo(url: str, filename: str | None, version: str, name: str, timestamp: TimestampWithTimezone | None, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#

Bases: BasePackageInfo

Method generated by attrs for class GolangPackageInfo.

class swh.loader.package.golang.loader.GolangLoader(storage: StorageInterface, url: str, max_content_size: int | None = None, **kwargs)[source]#

Bases: PackageLoader[GolangPackageInfo]

Load Golang module zip file into SWH archive.

Loader’s constructor. This raises exception if the minimal required

configuration is missing (cf. fn:check method).

Parameters:
  • storage – Storage instance

  • url – Origin url to load data from

visit_type: str = 'golang'#
GOLANG_PKG_DEV_URL = 'https://pkg.go.dev'#
GOLANG_PROXY_URL = 'https://proxy.golang.org'#
get_versions() Sequence[str][source]#

Return the list of all published package versions.

Raises:

classswh.loader.exception.NotFound error when failing to read the published package versions.

Returns:

Sequence of published versions

get_default_version() str[source]#

Retrieve the latest release version if any.

Returns:

Latest version

get_package_info(version: str) Iterator[Tuple[str, GolangPackageInfo]][source]#
Given a release version of a package, retrieve the associated

package information for such version.

Parameters:

version – Package version

Returns:

(branch name, package metadata)

build_release(p_info: GolangPackageInfo, uncompressed_path: str, directory: bytes) Release | None[source]#

Build the release from the archive metadata (extrinsic artifact metadata) and the intrinsic metadata.

Parameters:
  • p_info – Package information

  • uncompressed_path – Artifact uncompressed path on disk