zips

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2019 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModulePath

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 HTTPOptions

type HTTPOptions struct {
	Timeout time.Duration
}

type ProxyClient added in v0.6.0

type ProxyClient interface {
	// Get returns the contents of the repo specified by the coordinates
	Get(coordinates.Module) (repository.Blob, error)
	// List returns all available versions of the repo specified by the coordinates, in descending logical order
	List(source string) ([]semantic.Tag, error)
}

A ProxyClient is used for making requests to a Go Module Proxy which is expected to return archives already in the correct format.

func NewProxyClient added in v0.6.0

func NewProxyClient(opts ProxyClientOptions) ProxyClient

NewProxyClient creates a ProxyClient with some options.

type ProxyClientMock added in v0.6.0

type ProxyClientMock struct {
	GetMock mProxyClientMockGet

	ListMock mProxyClientMockList
	// contains filtered or unexported fields
}

ProxyClientMock implements ProxyClient

func NewProxyClientMock added in v0.6.0

func NewProxyClientMock(t minimock.Tester) *ProxyClientMock

NewProxyClientMock returns a mock for ProxyClient

func (*ProxyClientMock) Get added in v0.6.0

func (mmGet *ProxyClientMock) Get(m1 coordinates.Module) (b1 repository.Blob, err error)

Get implements ProxyClient

func (*ProxyClientMock) GetAfterCounter added in v0.6.0

func (mmGet *ProxyClientMock) GetAfterCounter() uint64

GetAfterCounter returns a count of finished ProxyClientMock.Get invocations

func (*ProxyClientMock) GetBeforeCounter added in v0.6.0

func (mmGet *ProxyClientMock) GetBeforeCounter() uint64

GetBeforeCounter returns a count of ProxyClientMock.Get invocations

func (*ProxyClientMock) List added in v0.10.0

func (mmList *ProxyClientMock) List(source string) (ta1 []semantic.Tag, err error)

List implements ProxyClient

func (*ProxyClientMock) ListAfterCounter added in v0.10.0

func (mmList *ProxyClientMock) ListAfterCounter() uint64

ListAfterCounter returns a count of finished ProxyClientMock.List invocations

func (*ProxyClientMock) ListBeforeCounter added in v0.10.0

func (mmList *ProxyClientMock) ListBeforeCounter() uint64

ListBeforeCounter returns a count of ProxyClientMock.List invocations

func (*ProxyClientMock) MinimockFinish added in v0.6.0

func (m *ProxyClientMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*ProxyClientMock) MinimockGetDone added in v0.6.0

func (m *ProxyClientMock) MinimockGetDone() bool

MinimockGetDone returns true if the count of the Get invocations corresponds the number of defined expectations

func (*ProxyClientMock) MinimockGetInspect added in v0.6.0

func (m *ProxyClientMock) MinimockGetInspect()

MinimockGetInspect logs each unmet expectation

func (*ProxyClientMock) MinimockListDone added in v0.10.0

func (m *ProxyClientMock) MinimockListDone() bool

MinimockListDone returns true if the count of the List invocations corresponds the number of defined expectations

func (*ProxyClientMock) MinimockListInspect added in v0.10.0

func (m *ProxyClientMock) MinimockListInspect()

MinimockListInspect logs each unmet expectation

func (*ProxyClientMock) MinimockWait added in v0.6.0

func (m *ProxyClientMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

type ProxyClientMockGetExpectation added in v0.6.0

type ProxyClientMockGetExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ProxyClientMockGetExpectation specifies expectation struct of the ProxyClient.Get

func (*ProxyClientMockGetExpectation) Then added in v0.6.0

Then sets up ProxyClient.Get return parameters for the expectation previously defined by the When method

type ProxyClientMockGetParams added in v0.6.0

type ProxyClientMockGetParams struct {
	// contains filtered or unexported fields
}

ProxyClientMockGetParams contains parameters of the ProxyClient.Get

type ProxyClientMockGetResults added in v0.6.0

type ProxyClientMockGetResults struct {
	// contains filtered or unexported fields
}

ProxyClientMockGetResults contains results of the ProxyClient.Get

type ProxyClientMockListExpectation added in v0.10.0

type ProxyClientMockListExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ProxyClientMockListExpectation specifies expectation struct of the ProxyClient.List

func (*ProxyClientMockListExpectation) Then added in v0.10.0

Then sets up ProxyClient.List return parameters for the expectation previously defined by the When method

type ProxyClientMockListParams added in v0.10.0

type ProxyClientMockListParams struct {
	// contains filtered or unexported fields
}

ProxyClientMockListParams contains parameters of the ProxyClient.List

type ProxyClientMockListResults added in v0.10.0

type ProxyClientMockListResults struct {
	// contains filtered or unexported fields
}

ProxyClientMockListResults contains results of the ProxyClient.List

type ProxyClientOptions added in v0.6.0

type ProxyClientOptions struct {
	Protocol string        // typically https
	BaseURL  string        // typically proxy.golang.org
	Timeout  time.Duration // about 1 minute is good
}

type UpstreamClient added in v0.6.0

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

UpstreamClient is used to download .zip files from an upstream origin (e.g. github.com). The returned Blob is in a git archive format that must be unpacked and repacked in the way that Go modules are expected to be. This is done using Rewrite.

func NewHTTPClient

func NewHTTPClient(options HTTPOptions) UpstreamClient

func NewUpstreamClient added in v0.6.0

func NewUpstreamClient(clients ...UpstreamClient) UpstreamClient

type UpstreamClientMock added in v0.6.0

type UpstreamClientMock struct {
	GetMock mUpstreamClientMockGet

	ProtocolsMock mUpstreamClientMockProtocols
	// contains filtered or unexported fields
}

UpstreamClientMock implements UpstreamClient

func NewUpstreamClientMock added in v0.6.0

func NewUpstreamClientMock(t minimock.Tester) *UpstreamClientMock

NewUpstreamClientMock returns a mock for UpstreamClient

func (*UpstreamClientMock) Get added in v0.6.0

func (mmGet *UpstreamClientMock) Get(rp1 *upstream.Request) (b1 repository.Blob, err error)

Get implements UpstreamClient

func (*UpstreamClientMock) GetAfterCounter added in v0.6.0

func (mmGet *UpstreamClientMock) GetAfterCounter() uint64

GetAfterCounter returns a count of finished UpstreamClientMock.Get invocations

func (*UpstreamClientMock) GetBeforeCounter added in v0.6.0

func (mmGet *UpstreamClientMock) GetBeforeCounter() uint64

GetBeforeCounter returns a count of UpstreamClientMock.Get invocations

func (*UpstreamClientMock) MinimockFinish added in v0.6.0

func (m *UpstreamClientMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*UpstreamClientMock) MinimockGetDone added in v0.6.0

func (m *UpstreamClientMock) MinimockGetDone() bool

MinimockGetDone returns true if the count of the Get invocations corresponds the number of defined expectations

func (*UpstreamClientMock) MinimockGetInspect added in v0.6.0

func (m *UpstreamClientMock) MinimockGetInspect()

MinimockGetInspect logs each unmet expectation

func (*UpstreamClientMock) MinimockProtocolsDone added in v0.6.0

func (m *UpstreamClientMock) MinimockProtocolsDone() bool

MinimockProtocolsDone returns true if the count of the Protocols invocations corresponds the number of defined expectations

func (*UpstreamClientMock) MinimockProtocolsInspect added in v0.6.0

func (m *UpstreamClientMock) MinimockProtocolsInspect()

MinimockProtocolsInspect logs each unmet expectation

func (*UpstreamClientMock) MinimockWait added in v0.6.0

func (m *UpstreamClientMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*UpstreamClientMock) Protocols added in v0.6.0

func (mmProtocols *UpstreamClientMock) Protocols() (sa1 []string)

Protocols implements UpstreamClient

func (*UpstreamClientMock) ProtocolsAfterCounter added in v0.6.0

func (mmProtocols *UpstreamClientMock) ProtocolsAfterCounter() uint64

ProtocolsAfterCounter returns a count of finished UpstreamClientMock.Protocols invocations

func (*UpstreamClientMock) ProtocolsBeforeCounter added in v0.6.0

func (mmProtocols *UpstreamClientMock) ProtocolsBeforeCounter() uint64

ProtocolsBeforeCounter returns a count of UpstreamClientMock.Protocols invocations

type UpstreamClientMockGetExpectation added in v0.6.0

type UpstreamClientMockGetExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

UpstreamClientMockGetExpectation specifies expectation struct of the UpstreamClient.Get

func (*UpstreamClientMockGetExpectation) Then added in v0.6.0

Then sets up UpstreamClient.Get return parameters for the expectation previously defined by the When method

type UpstreamClientMockGetParams added in v0.6.0

type UpstreamClientMockGetParams struct {
	// contains filtered or unexported fields
}

UpstreamClientMockGetParams contains parameters of the UpstreamClient.Get

type UpstreamClientMockGetResults added in v0.6.0

type UpstreamClientMockGetResults struct {
	// contains filtered or unexported fields
}

UpstreamClientMockGetResults contains results of the UpstreamClient.Get

type UpstreamClientMockProtocolsExpectation added in v0.6.0

type UpstreamClientMockProtocolsExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

UpstreamClientMockProtocolsExpectation specifies expectation struct of the UpstreamClient.Protocols

type UpstreamClientMockProtocolsResults added in v0.6.0

type UpstreamClientMockProtocolsResults struct {
	// contains filtered or unexported fields
}

UpstreamClientMockProtocolsResults contains results of the UpstreamClient.Protocols

Jump to

Keyboard shortcuts

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