Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the failure of go get downloading package

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to solve the failure of go get download package". The explanation content in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it to study and learn "how to solve the failure of go get download package" together!

Go get download package failure problem

Due to some force majeure reasons, timeout problems often occur when installing packages using the go get command in China. This article describes several common solutions.

Clone from github

Golang has created a mirror library on github, such as https://github.com/golang/net corresponding to https://golang.org/x/net mirror library. To download the golang.org/x/net package, you can use git clone to pull the source code file of the corresponding package after creating the directory of the package locally, as follows:

mkdir -p $GOPATH/src/golang.org/xcd $GOPATH/src/golang.org/xgit clone https://github.com/golang/net.git Use gopm

Gopm can be downloaded from a number of mirror sites at golang. org.

Install gopmgo get -u github.com/gpmgo/gopm Install third-party packages using gopm

Without the-g parameter, the dependency package will be downloaded under the.vendor directory; with the-g parameter, the dependency package can be downloaded to the GOPATH directory.

gopm get -g golang.org/x/net Use goproxy

After version 1.11 of Go, you can set the GOPROXY variable to set the proxy. If you have your own proxy server, you can set this environment variable to your proxy. First open the go module Support:

Running on Mac/Linux:

export GO111MODULE=on

Windows Platform Execution:

SET GO111MODULE=on

2019.6.10 Update: goproxy.cn

Here we take https://goproxy. cn as an example:

On Mac/Linux, you can execute the following command:

export GOPROXY=https://goproxy.cn

For Windows platforms, execute the following command in cmd to set:

SET GOPROXY="https://goproxy.cn"

Or execute in PowerShell:

C:\> $env:GOPROXY = "https://goproxy.cn" Thank you for reading, the above is "how to solve the go get download package failure" content, after the study of this article, I believe everyone on how to solve the go get download package failure This problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report