Skip to content

Conversation

@greeddj
Copy link
Contributor

@greeddj greeddj commented Dec 7, 2025

Hello

This PR adds support for loading golang modules by specifying a hub service as GOPROXY.

export GOPROXY=http://localhost:6587/goproxy/golang

The implemented functionality in general follows the guidelines described in the official Go module proxy protocol: https://go.dev/ref/mod#goproxy-protocol.

Here are some examples

➜ http http://localhost:6587/goproxy/golang/github.com/russross/blackfriday/v2/@v/list
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 34
Content-Type: text/plain; charset=utf-8
Date: Sun, 07 Dec 2025 17:53:30 GMT
Last-Modified: Sun, 07 Dec 2025 17:53:30 GMT
Server: hub/dev (601a6353726c0622b609179cf1b0697906e5cd9c)
X-Cache-Status: MISS

v2.0.0
v2.1.0-pre.1
v2.1.0
v2.0.1


➜ http http://localhost:6587/goproxy/golang/github.com/russross/blackfriday/v2/@latest
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 50
Content-Type: application/json
Date: Sun, 07 Dec 2025 17:53:38 GMT
Last-Modified: Sun, 07 Dec 2025 17:50:06 GMT
Server: hub/dev (601a6353726c0622b609179cf1b0697906e5cd9c)
X-Cache-Status: HIT

{
    "Time": "2020-10-27T03:47:54Z",
    "Version": "v2.1.0"
}


➜ http http://localhost:6587/goproxy/golang/github.com/russross/blackfriday/v2/@v/v2.1.0.info
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 50
Content-Type: application/json
Date: Sun, 07 Dec 2025 17:54:08 GMT
Last-Modified: Sun, 07 Dec 2025 17:54:08 GMT
Server: hub/dev (601a6353726c0622b609179cf1b0697906e5cd9c)
X-Cache-Status: MISS

{
    "Time": "2020-10-27T03:47:54Z",
    "Version": "v2.1.0"
}


➜ http http://localhost:6587/goproxy/golang/github.com/russross/blackfriday/v2/@v/v2.1.0.mod
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 42
Content-Type: text/plain; charset=utf-8
Date: Sun, 07 Dec 2025 17:54:24 GMT
Last-Modified: Sat, 07 Nov 2020 22:42:11 GMT
Server: hub/dev (601a6353726c0622b609179cf1b0697906e5cd9c)
X-Cache-Status: MISS

module github.com/russross/blackfriday/v2


➜ http http://localhost:6587/goproxy/golang/github.com/russross/blackfriday/v2/@v/v2.1.0.zip
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 122358
Content-Type: application/zip
Date: Sun, 07 Dec 2025 17:55:35 GMT
Last-Modified: Sat, 07 Nov 2020 22:42:11 GMT
Server: hub/dev (601a6353726c0622b609179cf1b0697906e5cd9c)
X-Cache-Status: HIT



+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+

Also:

  • Updated README.md
  • Updated go version and depth

Let me know if any adjustments are needed.

@psvmcc
Copy link
Owner

psvmcc commented Dec 8, 2025

LGFM, thank you!

@psvmcc psvmcc merged commit 619ba33 into psvmcc:main Dec 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants