zips

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2019 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModulePath added in v0.0.12

func ModulePath(mod []byte) string

Copied from cmd/go/internal/modfile/read.go

ModulePath returns the module path from the gomod file text. If it cannot find a module path, it returns an empty string. It is tolerant of unrelated problems in the go.mod file.

func Rewrite

Rewrite the zip we downloaded from the upstream VCS into a zip file in the format required by the go/cmd tooling. Fundamentally the zip file the Go tooling requires re-namespacing the content under the directory path of the module.

Additionally, the go/cmd does the following - limits the size of upstream .zip file to 500 MiB - limits the size of upstream LICENSE to 16 MiB - limits the size of upstream go.mod file to 16MiB - - removes other modules living in the same repo -

The only complete "documentation" for the format of the new zip archive is in the go tool source code: go/src/cmd/go/internal/modfetch/coderepo.go

The zip may contain multiple modules, each with its own go.mod. We need to prune everything that isn't in our module.

Types

type Client

type Client interface {
	Get(*upstream.Request) (repository.Blob, error)
	Protocols() []string
}

Client is used to download .zip files from an upstream origin (e.g. github.com).

func NewClient

func NewClient(clients ...Client) Client

func NewHTTPClient

func NewHTTPClient(options HTTPOptions) Client

type HTTPOptions

type HTTPOptions struct {
	Timeout time.Duration
}

Directories

Path Synopsis
Package zipstest contains autogenerated mocks.
Package zipstest contains autogenerated mocks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL