testmodproxy

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFS

func LoadFS(rootDir string) (fs.FS, error)

LoadFS creates a virtual filesystem that implements the Go module proxy protocol. It scans a directory of module source code and automatically generates all the necessary proxy files: /@v/list, /@v/{version}.mod, /@v/{version}.zip, and /@v/{version}.info.

The input directory structure should be: rootDir/

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

The returned filesystem can be used with http.FileServer(http.FS(fsys)) to serve a module proxy over HTTP, or with os.CopyFS(dir, fsys) to write the proxy files to disk for use with file:// URLs.

Types

type Proxy

type Proxy struct {
	Name string
	URL  string
}

Proxy is a named test proxy url.

func LoadProxies

func LoadProxies(t *testing.T, rootDir string) []Proxy

LoadProxies creates an http:// and file:// proxy for testing. See LoadFS for input directory format.

Jump to

Keyboard shortcuts

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