How to use Golang’s “go get” from behind a proxy.

In a perfect world employers would trust their employees, governments would care about the average person, and cats and dogs would get along together. Unfortunately the reality is that many organizations must use traffic proxies for both security and compliance with federal regulation. Luckily there is a way for Golang’s package manager “get” to work in such an environment. In this article we will look into how to clone a Golang based program from behind a corporate network proxy.

My Situation

This process is executed on a Windows 10 (build 1709) on a HP notebook. Inside of this is running Ubuntu 18.04 via the Windows Subsystem for Linux (WSL) feature. All of this on a corporate network, connects to a client’s network via VPN. The network chain looks like this (even before the ‘internet’): local machine -> corporate network -> VPN tunnel connection -> client corporate network.


Opening Ubuntu WSL I received the typical command prompt and entered the user password. Once log in completed I changed directories (cd) to the user’s home directory.

WSL is not 100% Linux, but it works, kinda, sorta.

The first thing I tried was the recommended command as documented in the README file.

go get

But that just got me an error, not surprising really.

Interesting. GiT is not able to access the URL. So somewhere between my machine and the GitHub servers the communication routing fails. I wanted to trace the traffic to see where the requests started to fail. So I installed and ran traceroute to

sudo apt-get install -y traceroute
29 * * *
30 * * *

It would seem traceroute fails. Next I tried a curl request:

More dots more dots more dots; STOP ALL THE DOTS!

Ah! “302 not allowed”. And it looks like the Location cURL was redirected to is the ProxyWarning.html page from the organizations proxy gateway.

This means we need to set the proxy setting for GiT. I knew that weeks back I have set the proxy value for Ubuntu’s APT program, so I tail’d APT”s config file for the value. To finish up I ran a git list command to ensure the value was saved.

$ tail /etc/apt/apt.conf
Acquire::http::Proxy "http://YOUR_PROXY_URL_HERE:8888";

$ git config --global http.proxy YOUR_PROXY_URL_HERE:8888

$ git config --global --list

With the GiT proxy value now set I tried the following command…

go get

After what seemed like hours (< 3 minutes) I received a different return message than before: nothing. I was back at the command prompt with no output. Could this mean return code 0? Doing a ls command of the ~/go/src directory. Hurrah! The project was indeed downloaded.

Super Green!


With a little troubleshooting, knowledge share, and documentation reading I was able to get leverage the configuration ability of GiT to continue using “go get” to install applications. It would seem any program that downloads on a port other that 80 will need to be configured. May I should look into http_proxt global usage.

Do you have any knowledge about configuring programs to use proxy pass-throughs? Do you think corporate proxies are useless; or a necessity for the internet of today? Comment below and let me know.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.