Re: [bitbake-devel] [PATCH] fetch2/gomod: support pipe-separated proxy list in GO_MOD_PROXY
Richard Purdie <[email protected]> Thu, 16 Jul 2026 11:50:46 +0100
| Newsgroups | org.openembedded.lists.bitbake-devel |
|---|---|
| Message-ID | <c478045e04d75850787d48e821ee6e27a9b28555.camel@linuxfoundation.org> |
Hi,=C2=A0 Thanks for the patch. On Fri, 2026-07-10 at 17:40 +0800, tengf via lists.openembedded.org wrote: > From cb7d8f5176781eb441ec83241f05ab272d4611c6 Mon Sep 17 00:00:00 2001 > From: tengf <[email protected]> > Date: Fri, 10 Jul 2026 16:54:20 +0800 > Subject: [PATCH] fetch2/gomod: support pipe-separated proxy list in > =C2=A0GO_MOD_PROXY > MIME-Version: 1.0 > Content-Type: text/plain; charset=3DUTF-8 > Content-Transfer-Encoding: 8bit >=20 > The Go toolchain supports GOPROXY as a pipe-separated list of proxies > tried in order (e.g. "goproxy.cn|proxy.golang.org|direct"). The BitBake > gomod fetcher previously passed the entire string verbatim as an HTTP > hostname, causing fetch failures in environments where proxy.golang.org > is unreachable and a mirror such as goproxy.cn is required. >=20 > Parse GO_MOD_PROXY as a '|'-separated list and try each proxy in order > in a new download() override on the GoMod class. The special token > "direct" is silently skipped =E2=80=94 direct VCS fetching is handled by = the > gomodgit fetcher. If every proxy fails, a FetchError is raised listing > the module and version. A single proxy value (the existing usage) is > fully backward compatible. >=20 > Add two unit tests that exercise proxy-list parsing without requiring > network access: > - test_gomod_multi_proxy_uses_first_proxy: verifies the first non-direct > =C2=A0 proxy is selected for ud.url and that the full proxy list is store= d. > - test_gomod_direct_only_falls_back_to_default: verifies that a > =C2=A0 "direct"-only value falls back to proxy.golang.org. >=20 > Signed-off-by: tengf <[email protected]> I wanted to ask how this interacts with MIRRORS/PREMIRRORS? Those mechanisms are meant to be how we configure builds to use alternative servers so in theory, people would expect to see mirror configurations set there. GO_MOD_PROXY is providing a different mechanism, native to go, to effectively do the same thing as I understand it. I am a little worried about being able to configure the build to use different urls to the ones it would appear to be configured with. Cheers, Richard