Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: x/dl: add GODLPROXY= for support to specify the download site of the go installation package #61296

Open
notobject opened this issue Jul 11, 2023 · 5 comments
Labels
Milestone

Comments

@notobject
Copy link

notobject commented Jul 11, 2023

add GODLPROXY= to specify the download site of the go installation package, and use the current address (https://dl.google.com/go/) as the default value instead of the only value

this proposal is about multi-version. see Managing Go installations
I have installed 1.16.2 now, and I also want to experience 1.20.5, so I found pkg golang.org/dl, But when I try to execute go1.20.5 download, its default behavior is to download the compressed file required from https://dl.google.com/go, and this address cannot be configured. I can't connect to this address in my development environment, but there are mirror sites that can replace it, so I propose to add an environment variable to allow the configuration of the download address.

file dl/internal/version/version.go

// versionArchiveURL returns the zip or tar.gz URL of the given Go version.
func versionArchiveURL(version string) string {
        goos := getOS()

        ext := ".tar.gz"
        if goos == "windows" {
                ext = ".zip"
        }
        arch := runtime.GOARCH
        if goos == "linux" && runtime.GOARCH == "arm" {
                arch = "armv6l"
        }
        downloadURL := "https://dl.google.com/go/"
        
         // TODO use GODLPROXY if not empty 

        return downloadURL + version + "." + goos + "-" + arch + ext
}
@gopherbot gopherbot added this to the Proposal milestone Jul 11, 2023
@dmitshur
Copy link
Contributor

Have you considered the existing proxy support in the net/http package via the HTTPS_PROXY and similar environment variables?

@seankhliao
Copy link
Member

I thought the original discussion in #55092 proposed using the module proxy directly?

@heschi
Copy link
Contributor

heschi commented Jul 11, 2023

This is about the golang.org/x/dl commands, e.g. go1.20.6, not about #55092. But I think it's basically obsoleted by the forward compatibility stuff launching in 1.21.

@notobject
Copy link
Author

notobject commented Jul 12, 2023

This is about the golang.org/x/dl commands, e.g. go1.20.6, not about #55092. But I think it's basically obsoleted by the forward compatibility stuff launching in 1.21.

Yes, this proposal is about multi-version. see Managing Go installations
I have installed 1.16.2 now, and I also want to experience 1.20.5, so I found pkg golang.org/dl, But when I try to execute go1.20.5 download, its default behavior is to download the compressed file required from https://dl.google.com/go, and this address cannot be configured. I can't connect to this address in my development environment, but there are mirror sites that can replace it, so I propose to add an environment variable to allow the configuration of the download address.

@go101
Copy link

go101 commented Jul 12, 2023

For each toolchain release, we can create a Go module project by using the Go embedding feature to embed the whole toolchain release, so that the dl command can be re-written to call go get to download the toolchain release.

@ianlancetaylor ianlancetaylor changed the title proposal: dl: add GODLPROXY= for support to specify the download site of the go installation package proposal: x/dl: add GODLPROXY= for support to specify the download site of the go installation package Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

6 participants