gomodule

package
v0.0.0-...-86b2471 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorIsCode

func ErrorIsCode(err error, code ErrorCode) bool

func NewErrorf

func NewErrorf(code ErrorCode, format string, args ...interface{}) error

Types

type ErrorCode

type ErrorCode int
const (
	NotFound ErrorCode = iota + 1
)

func GetErrorCode

func GetErrorCode(err error) ErrorCode

type Info

type Info struct {
	Version string    // version string
	Time    time.Time // commit time
}

Info represents metadata of a particular module version. See Service.

type Service

type Service interface {
	// Returns a non-nil error e such that ErrorIsCode(e, NotFound) is true if the specified module version does not exist.
	//	 Implementors can create an error e such that ErrorIsCode(e, NotFound) is true by calling NewErrorf(NotFound,, "...", ...).
	Info(ctx context.Context, moduleVersion *module.Version) (*Info, error)

	// Returns a non-nil error e such that ErrorIsCode(e, NotFound) is true if the specified module version does not exist.
	//	 Implementors can create an error e such that ErrorIsCode(e, NotFound) is true by calling NewErrorf(NotFound,, "...", ...).
	Latest(ctx context.Context, modulePath string) (*Info, error)

	// List returns an io.ReadCloser who's byte stream is the concatenation of version+"\n" for each version of the specified module.
	List(ctx context.Context, modulePath string) (io.ReadCloser, error)

	// Zip returns an an io.ReadCloser who's byte stream is a zip archive containing all relevant files of the specified module version.s
	// Returns a non-nil error e such that ErrorIsCode(e, NotFound) is true if the specified module version does not exist.
	//	 Implementors can create an error e such that ErrorIsCode(e, NotFound) is true by calling NewErrorf(NotFound,, "...", ...).
	Zip(ctx context.Context, moduleVersion *module.Version) (io.ReadCloser, error)

	// GoMod returns an io.ReadCloser who's byte stream is the go.mod file (UTF-8 encoded) of the specified module version.
	// Returns a non-nil error e such that ErrorIsCode(e, NotFound) is true if the specified module version does not exist.
	//	 Implementors can create an error e such that ErrorIsCode(e, NotFound) is true by calling NewErrorf(NotFound,, "...", ...).
	GoMod(ctx context.Context, moduleVersion *module.Version) (io.ReadCloser, error)
}

Service is a strongly-typed interface for the Go module proxy protocol https://golang.org/cmd/go/#hdr-Module_proxy_protocol.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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