当前位置:网站首页>Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout

Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout

2022-07-04 12:54:00 Late night watch listening

problem

A few days ago, I was curious to add an official community group of domestic alliance chain blockchain , Then someone compiles a tool go module Download has timed out , Then I used Alibaba cloud's image , The command looks ok as follows , But still timeout .
 Alibaba cloud image service  Changed the image, but still timeout

verification

But I clean up here module cache , Verify that the Alibaba cloud image is indeed hung , But it is normal to change other mirror agents , That's ridiculous .
 Alibaba cloud cannot , But after switching, the others are still normal

Analyze the causes and solutions

Then the reason must be the configuration problem , So I checked the man's bash command , There is a problem , as follows :
 The proxy settings did not take effect
Be reasonable export The command is always valid when the terminal is not turned off , But he has another detail here. I don't know if you have found it , He abused it sudo command , He compiled the command with sudo make, however root What the user is looking for golang Environment variables have not been modified , So the last one export The command is input in vain .
It's also easy to solve , Directly use the following command to modify go env environment variable

go env -w GO111MODULE=on #-w  Indicates to modify the default value of the environment variable 

go env -w GOPROXY=https://goproxy.io,direct

Use... After modification go env Check whether the order has been changed , Last make Get it done .

 Insert picture description here

I have to say that it's really cool to pretend to be forced :)

🥰 If you like, you can also buy me juice 🥰

Reward / Donate

 The picture died of laughter
原网站

版权声明
本文为[Late night watch listening]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/185/202207041015307096.html