goproxytest

package
v0.6.3-rc.6 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: BSD-3-Clause, BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package goproxytest serves Go modules from a proxy server designed to run on localhost during tests, both to make tests avoid requiring specific network servers and also to make them significantly faster.

Each module archive is either a file named path_vers.txt or a directory named path_vers, where slashes in path have been replaced with underscores. The archive or directory must contain two files ".info" and ".mod", to be served as the info and mod files in the proxy protocol (see https://research.swtch.com/vgo-module). The remaining files are served as the content of the module zip file. The path@vers prefix required of files in the zip file is added automatically by the proxy: the files in the archive have names without the prefix, like plain "go.mod", "x.go", and so on.

See ../cmd/txtar-addmod and ../cmd/txtar-c for tools generate txtar files, although it's fine to write them by hand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	URL string
	// contains filtered or unexported fields
}

func NewServer

func NewServer(dir, addr string) (*Server, error)

StartProxy starts the Go module proxy listening on the given network address. It serves modules taken from the given directory name. If addr is empty, it will listen on an arbitrary localhost port. If dir is empty, "testmod" will be used.

The returned Server should be closed after use.

func (*Server) Close

func (srv *Server) Close()

Close shuts down the proxy.

Jump to

Keyboard shortcuts

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