Repository navigation
golang: add golang downloader - #194
Paulkm2006 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new golang.py mirror sync script intended to fetch Go release metadata from go.dev and download artifacts concurrently into a local working directory (tunasync-style).
Changes:
- Introduces
RemoteSite+GoReleasemodeling to enumerate Go release artifacts from go.dev. - Adds a threaded download worker queue with optional include/exclude filtering and SHA256 verification.
- Implements a local cleanup step to delete files not present in the computed upstream file list.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| def _fetch_releases(self): | ||
| """Fetch releases from the JSON API or HTML page.""" | ||
|
|
||
| # self._fetch_from_json() |
There was a problem hiding this comment.
只从 JSON 获取 stable (supported) release 是有必要的,因为对于空间紧张的镜像站来说,很多时候不希望同步的仓库大小是无限增长的。另外对于只获取 stable release 的情况,可能还需要移除上游已经去除的文件。
|
脚本已在 hust-mirrors 运行并通过验证。网页所展示的同步失败原因是华中科技大学校园网环境对 go.dev 的连通性不佳,可能导致间接性失败 |
|
One concern from the mirror-operator side (we run a /golang mirror at NJU): storing files as |
|
Follow-up with evidence on the layout question — the PR code and your own production site disagree:
So it looks like HUST runs a different (flat-layout) iteration than what is pushed here. If your local version already stores flat, could you push it? That would resolve the compatibility concern entirely — with a flat layout matching dl.google.com/go/, prefix-substitution from the official URLs just works. |
|
I ran the exact code from this PR (4b04007) in a clean container to verify the on-disk layout empirically: So the current PR writes
A two-level mirror breaks URL compatibility with upstream (go.dev/dl/ redirect targets, gvm/asdf/goenv and hard-coded download URLs all expect the flat layout). Could you switch One more finding from the test: if a download fails, the worker thread only prints a traceback and swallows the exception, so the script still prints |
|
Hi @yaoge123 , Sorry for the late response, and thank you for your valuable feedback! I'll implement a switch for flat directory structure (which will be the default structure) and better return value for downloading faults. As for the HUST mirrors inconsistency, we initially adopted the scripts I proposed here, but our campus network started to fail on syncing from Google quite often this semester. Thus, we changed our upstream provider to NJU, which uses the flat directory structure. |
|
Hi @yaoge123 , |
This PR implements a golang downloader, which retrieves all versions and download links from the golang official website https://go.dev/dl/ , and download them concurrently.