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.