testmodproxy

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	Path     string
	Versions map[string]*ModuleVersion
}

func (*Module) List

func (m *Module) List() []string

type ModuleProxy

type ModuleProxy struct {
	Modules map[string]*Module
}

ModuleProxy is a bare-bones Go module proxy for offline testing. It preloads all module data into memory for fast serving.

func Load

func Load(rootDir string) (*ModuleProxy, error)

Load creates a new TestModuleProxy that serves modules from the given directory. The directory structure should be: rootDir/

example.com/
  module1/
    @v/
      v1.0.0/
        go.mod
        main.go
        ...
      v1.1.0/
        go.mod
        main.go
        ...

func (*ModuleProxy) ServeHTTP

func (p *ModuleProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

type ModuleVersion

type ModuleVersion struct {
	Version string
	Mod     []byte
	Zip     []byte
}

Jump to

Keyboard shortcuts

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