go.dev returns 404 and proxy.golang.org returns 403

bulletproof VPN - stay anonymous

I was trying to install Go and then Xray-core on a Russian VPS, but it turned out to be quite a challenge.

I can install with:

sudo apt install golang -y

Right? Debian 12 will install Go 1.19 (!), the oldest piece of software known to humans, and the Xray-core build requires at least 1.21+, so it’s not an option.

Installing Go with a classic download and untarring it with

wget https://go.dev/dl/go1.21.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.21.4.linux-amd64.tar.gz
rm go1.21.4.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc

will FAIL, because go.dev redirects to dl.google.com and then it responds with a 404. Yeah, not even a 403, the correct HTTP code for denying users access to open-source software. I thought, well, they obviously recognize my IP as a proxy/VPN and block me for not being a good citizen and not having a proper government-mandated clean IP. But no, connecting through Tor works for some reason:

sudo apt install torsocks -y
torsocks wget https://go.dev/dl/go1.21.4.linux-amd64.tar.gz

Alright, cool.

# Clone xray-core
git clone https://github.com/XTLS/Xray-core
cd Xray-core
# Build and install
go env -w GOTOOLCHAIN=auto
CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main

We are almost there!! Uh-oh:

/root/go/pkg/mod/github.com/refraction-networking/utls@v1.8.0/u_handshake_client.go:16:2: github.com/klauspost/compress@v1.17.4: reading https://proxy.golang.org/github.com/klauspost/compress/@v/v1.17.4.zip: 403 Forbidden

Fucking hell. Alright, let’s try torsocks again:

CGO_ENABLED=0 torsocks go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main

Aaaaaaaand 403 again. Proxy.golang.org’s firewall just hates everyone, okay. I guess it protects them from evil hackers or something.
As we are neither evil nor hackers, we can and will bypass this firewall with a residential proxy. I personally use sx.org; you can use whatever you want, just make sure that your proxy is clean; check it on Whoer first. Set proxy:

ALL_PROXY=socks5://user:pass@ip:port

Rerun go build again:

CGO_ENABLED=0 go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main

And now it works!

If you want to support us, you can donate here: Donate