Can't install go modules on windows with proxy

go 1.24

C:\Users\user\hello>go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go: google.golang.org/protobuf/cmd/protoc-gen-go@latest: module google.golang.org/protobuf/cmd/protoc-gen-go: invalid response from proxy "http://company.proxy.com:8080/": invalid character '<' looking for beginning of value

Just set the system http/https proxy.

C:\Users\user>set | findstr http
HTTPS_PROXY=http://company.proxy.com:8080
HTTP_PROXY=http://company.proxy.com:8080

proxy variables are already set. But still the same error.

Does go provide some means to pass the proxy username/password?

If I add it in the http(s)_proxy variable it doesn’t accept as anything after a colon is considered a port number

try [scheme:][//[userinfo@] host][/] path[?query][#fragment] ?

Please read my info regarding ‘userinfo’

If I add it in the http(s)_proxy variable it doesn’t accept as anything after the first instance of colon is considered a port number.

To be honest, I don’t want to talk to you.
I don’t know why you have this strange problem.

set HTTP_PROXY=http://user:password@example.com:1081
set HTTPS_PROXY=http://user:password@example.com:1081

Have you really tried this? (I run it in my own win and use wget and it works)

If it doesn’t work, why not try other methods?

  1. Use proxy software, some global proxy programs can work well
  2. Write a simple http forwarding by yourself. Golang’s standard library comes with http.Proxy processing function.
  3. Find a reliable GOPROXY
  4. Some IDEs even come with proxy tools, such as goland.

Too many, have you been waiting for the community’s response instead of exploring methods automatically?

May be you need more explanation(I thought you’ve read my previous post clearly). Here is the console log.

C:\Users\user>set HTTP_PROXY=http://myuserid:mypass@company-proxy.com:8080

C:\Users\user>set HTTPS_PROXY=http://myuserid:mypass@company-proxy.com:8080

C:\Users\user>go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go: google.golang.org/protobuf/cmd/protoc-gen-go@latest: module google.golang.org/protobuf/cmd/protoc-gen-go: Get "http://compay-proxy.com:8080/google.golang.org/protobuf/cmd/protoc-gen-go/@v/list": proxyconnect tcp: dial tcp: lookup http: no such host

I’ve tried many things before posting it here. These problems are due to proxy at my company. Not even allowing me to start program with go(pathetic). I want to concentrate more on my task rather than trying trivial things.

Another piece form VS code

2025-02-24 16:27:19.850 [info] goimports: failed to install goimports(golang.org/x/tools/cmd/goimports@latest): Error: Command failed: C:\Program Files\Go\bin\go.exe install -v golang.org/x/tools/cmd/goimports@latest
go: golang.org/x/tools/cmd/goimports@latest: module golang.org/x/tools/cmd/goimports: invalid response from proxy "http://company-proxy.com:8080/": invalid character '<' looking for beginning of value

Are you sure your environment and proxy can reach google.golang.org? If your environment and proxy can’t, you should look for GOPROXY.

I can reach via web browser.
golang.org redirects me to go[dot]dev
google.golang.org redirects me to cloud[dot]google[dot]com/go/google[dot]golang[dot]org

C:\Users\user>set GOPROXY=https://proxy.golang.org,direct

C:\Users\user>go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go: google.golang.org/protobuf/cmd/protoc-gen-go@latest: module google.golang.org/protobuf/cmd/protoc-gen-go: Get "https://proxy.golang.org/google.golang.org/protobuf/cmd/protoc-gen-go/@v/list": proxyconnect tcp: dial tcp: lookup http: no such host