| 1 |
This directory holds Go modules served by a Go module proxy |
| 2 |
that runs on localhost during tests, both to make tests avoid |
| 3 |
requiring specific network servers and also to make them |
| 4 |
significantly faster. |
| 5 |
|
| 6 |
A small go get'able test module can be added here by running |
| 7 |
|
| 8 |
cd cmd/go/testdata |
| 9 |
go run addmod.go path@vers |
| 10 |
|
| 11 |
where path and vers are the module path and version to add here. |
| 12 |
|
| 13 |
For interactive experimentation using this set of modules, run: |
| 14 |
|
| 15 |
cd cmd/go |
| 16 |
go test -proxy=localhost:1234 & |
| 17 |
export GOPROXY=http://localhost:1234/mod |
| 18 |
|
| 19 |
and then run go commands as usual. |
| 20 |
|
| 21 |
Modules saved to this directory should be small: a few kilobytes at most. |
| 22 |
It is acceptable to edit the archives created by addmod.go to remove |
| 23 |
or shorten files. It is also acceptable to write module archives by hand: |
| 24 |
they need not be backed by some public git repo. |
| 25 |
|
| 26 |
Each module archive is named path_vers.txt, where slashes in path |
| 27 |
have been replaced with underscores. The archive must contain |
| 28 |
two files ".info" and ".mod", to be served as the info and mod files |
| 29 |
in the proxy protocol (see https://research.swtch.com/vgo-module). |
| 30 |
The remaining files are served as the content of the module zip file. |
| 31 |
The path@vers prefix required of files in the zip file is added |
| 32 |
automatically by the proxy: the files in the archive have names without |
| 33 |
the prefix, like plain "go.mod", "x.go", and so on. |
| 34 |
|
| 35 |
See ../addmod.go and ../savedir.go for tools to generate txtar files, |
| 36 |
although again it is also fine to write them by hand. |