vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Rewrite documentation around reader tasks
d1f44d838966c0a4762073f12375ec7562582fdf · Keenan Nemetz · 21h ago · parent 9103f6a8
docs/go-modules.md −80
| @@ -1,80 +0,0 @@ | |||
| 1 | # Go modules | ||
| 2 | |||
| 3 | Vole serves Go module discovery metadata for every public repository. A module's | ||
| 4 | import path is the instance host followed by the repository name, with no separate | ||
| 5 | vanity-import service: | ||
| 6 | |||
| 7 | ```text | ||
| 8 | <host>/<repository> | ||
| 9 | ``` | ||
| 10 | |||
| 11 | For example, Vole's own module is `rodent.software/vole`. | ||
| 12 | |||
| 13 | ## Configure a module | ||
| 14 | |||
| 15 | Set the instance's canonical origin: | ||
| 16 | |||
| 17 | ```toml | ||
| 18 | public_url = "https://forge.example.com" | ||
| 19 | ``` | ||
| 20 | |||
| 21 | Make the repository public and use the matching module path in its `go.mod`: | ||
| 22 | |||
| 23 | ```go | ||
| 24 | module forge.example.com/demo | ||
| 25 | ``` | ||
| 26 | |||
| 27 | From another Go project, fetch it normally: | ||
| 28 | |||
| 29 | ```sh | ||
| 30 | go get forge.example.com/demo | ||
| 31 | ``` | ||
| 32 | |||
| 33 | The host cannot include a port in a Go module path. An instance available only at | ||
| 34 | `https://forge.example.com:8443` can serve Git and web pages, but its repositories | ||
| 35 | cannot use that host and port as import paths; clone them by URL instead. | ||
| 36 | |||
| 37 | ## How discovery works | ||
| 38 | |||
| 39 | The `go` command requests the import path with `?go-get=1` and reads the returned | ||
| 40 | `go-import` metadata: | ||
| 41 | |||
| 42 | ```sh | ||
| 43 | curl -s 'https://rodent.software/vole?go-get=1' | ||
| 44 | ``` | ||
| 45 | |||
| 46 | The HTML includes: | ||
| 47 | |||
| 48 | ```html | ||
| 49 | <meta name="go-import" content="rodent.software/vole git https://rodent.software/vole.git"> | ||
| 50 | ``` | ||
| 51 | |||
| 52 | Go then clones `https://rodent.software/vole.git` and resolves packages and | ||
| 53 | versions from its Git refs. A package below the repository root uses the same | ||
| 54 | metadata: `rodent.software/vole/server/web` resolves within the | ||
| 55 | `rodent.software/vole` module. | ||
| 56 | |||
| 57 | The repository page is `/<repository>`, and its Git transport is | ||
| 58 | `/<repository>.git`. Both names therefore agree with the import path. | ||
| 59 | |||
| 60 | ## Public and private repositories | ||
| 61 | |||
| 62 | Go discovery is anonymous. Vole answers metadata requests only when an anonymous | ||
| 63 | reader can clone the repository, and returns `404` for private repositories so | ||
| 64 | the probe does not disclose their existence. | ||
| 65 | |||
| 66 | For a private module, clone it where the build runs and use a `replace` directive | ||
| 67 | to point at that checkout, or mirror a public repository for downstream users. | ||
| 68 | Renaming a published repository changes its import path and breaks downstream | ||
| 69 | modules; keep the original name or update those modules. | ||
| 70 | |||
| 71 | Repository names are unique on an instance. The reserved root names are `static`, | ||
| 72 | `robots.txt`, `sitemap.xml`, and `sitemap-pages.xml`; names beginning with `-` are | ||
| 73 | also unavailable because forge pages live under `/-/`. | ||
| 74 | |||
| 75 | ## Next | ||
| 76 | |||
| 77 | - [Configuration](configuration.md#public-url) — set the origin used in import | ||
| 78 | metadata. | ||
| 79 | - [Releases](releases.md) — publish the tags Go resolves as module versions. | ||
| 80 | - [Sites](sites.md) — host project documentation beside the module. | ||