https://pine32.be - © pine32.be 2026
Welcome! - 122 total posts. [RSS]
A Funny little cycle 2.0 [LATEST]


Search 122 posts with 50 unique tags


#1779009248


[ dev | golang | git ]

Last week when moving over to Codeberg (see post 1778177701) I noticed that I am using the github.com domain in my module names. For my projects (like mb) that fine, I just moved it to codeberg.org when moving the repo. But for libraries I can’t expect everybody to change their go.mod file every time I change were I host my code (not that anybody uses my libs but just go with it). Luckily the Go devs have though of this.

When trying to download a module, like github.com/ncruces/go-sqlite3 for example, go will make a http/https request like shown below. The webserver should then provide a special go-import meta tag that where and how it can pull the code.

curl -s 'https://github.com/ncruces/go-sqlite3?go-get=1' | grep go-import
<meta name="go-import" content="github.com/ncruces/go-sqlite3
    git https://github.com/ncruces/go-sqlite3.git">

Most code forges will handle this for you. But you can also deploy your own server on your own domain that handles this. And that is exactly what I have done, setup my own vanity URL. I made a simple stateless webserver for this that just takes a JSON config, source. Currently it will redirect to Codeberg but when I move my repos again I just have to change a basic config file and all modules will keep working as they are supposed to. I just have to make sure that go.pine32.be doesn’t go down. But it is a stateless app running 2 replicas on a highly available Kubernetes cluster, should be fine.

curl -s 'https://go.pine32.be/id?go-get=1' | grep go-import
<meta name="go-import" content="go.pine32.be/id
    git https://codeberg.org/Pineapple217/go-id">