• [gentoo-dev] [PATCH] [Format Fixed] go-module.eclass: live_vendor, fall

    From Ryan Qian@21:1/5 to All on Sat Dec 31 08:50:01 2022
    Golang does not support the 'socks5h://' schema for http[s]_proxy
    env variable: https://github.com/golang/go/blob/9123221ccf3c80c741ead5b6f2e960573b1676b9/src/vendor/golang.org/x/net/http/httpproxy/proxy.go#L152-L159,
    while libcurl supports it: https://github.com/curl/curl/blob/ae98b85020094fb04eee7e7b4ec4eb1a38a98b98/docs/libcurl/opts/CURLOPT_PROXY.3#L48-L59.
    So, if a 'https_proxy=socks5h://127.0.0.1:1080' env has been set in the make.conf to make curl (assuming curl is the current download command) to download all packages through the proxy, go-module_live_vendor will
    fail.

    The only difference between these two schemas is, 'socks5h' will solve
    the hostname via the proxy while 'socks5' will not. I think it's ok to fallback 'socks5h' to 'socks5' for `go vendor` command and warn user,
    until golang supports it.

    related to issue: https://github.com/golang/go/issues/24135
    Closes: https://github.com/gentoo/gentoo/pull/28887
    Signed-off-by: Ryan Qian <i@bitbili.net>

    diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass
    index 10ed475c5b11e..d1b5798b6f40f 100644
    --- a/eclass/go-module.eclass
    +++ b/eclass/go-module.eclass
    @@ -14,7 +14,7 @@
    # written in the go programming language that uses modules.
    # If the software you are packaging has a file named go.mod in its top level
    # directory, it uses modules.
    -#
    +#
    # Modules have been the preferred method of tracking dependencies in software
    # written in Go since version 1.16,
    # so if the software isn't using modules, it should be updated.
    @@ -119,13 +119,13 @@ RESTRICT+=" strip"
    #
    # You can use some combination of sed/awk/cut to extract the
    # contents of EGO_SUM or use the dev-go/get-ego-vendor tool.
    -#
    +#
    # One manual way to do this is the following:
    #
    # @CODE
    #
    # cat go.sum | cut -d" " -f1,2 | awk '{print "\t\"" $0 "\""}'
    -#
    +#
    # @CODE
    #
    # The format of go.sum is described upstream here:
    @@ -485,6 +485,27 @@ go-module_live_vendor() {
    [[ -d "${S}"/vendor ]] &&
    die "${FUNCNAME} only allowed when upstream isn't vendoring"

    + local hp
    + local -a hps
    + if [[ -n $HTTP_