Serving Go Modules via depp
depp is my homebrewed static page generator for Git repositories. I use it for hosting my own hobby projects. However, because all of my repositories are also mirrored on GitHub, I still depend on GitHub for a few features. One of those is hosting of Go Modules.
For a given import path, Go determines the underlying VCS repository using a special <meta> tag:
<meta name="go-import" content="root-path vcs repo-url [subdirectory]">In order to properly self-host my Go modules, instead of relying on GitHub, the HTML generated by depp needs to include this <meta> tag.
Inspired by cgit, depp can now include additional content in the HTML <head> using a custom git-config(5) option.
This feature was implemented with commit 1c04dee in the depp repository.
In order to use this feature, invoke git-config(5) in the bare repository on the Git server as follows:
git config depp.extra-head-content '<meta name="go-import" content="git.example.org/$REPO git https://git.example.org/$REPO.git">'
Afterward, regenerate the HTML and update all import paths in existing Go software.