Go get golang.org/x Package failure workaround

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Due to various problems, domestic use of Go get install Golang official package may fail, as I myself when installing Collidermain, the following error occurred:

$ go get collidermainpackage golang.org/x/net/websocket: unrecognized import path "golang.org/x/net/websocket" (https fetch: Get https://golang.org/x/net/websocket?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

Even if the agent does not work, how to solve this problem?

In fact, Golang built a mirrored library on GitHub, such as Https://github.com/golang/net, which is Https://golang.org/x/net's mirror library.

To get the Golang.org/x/net package, you only need the following steps:

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

This method can be used for package acquisition under other golang.org/x.

For example, many go software uses the contents of tools at compile time, using the following method to obtain:

Enter the x directory above and enter:

git clone https://github.com/golang/tools.git
  • Note that it is important to keep the directory structure that is obtained with go get consistent, otherwise the library will not be found.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.