Background
Due to various problems, go get is used to install golang official package in China It may fail. For example, when I installed collidermain myself, the following error occurred:
$ go get collidermain package 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)
Principle
In fact, golang has established a mirror library on github, such ashttps:// github.com/golang/net
is the mirror library ofhttps://golang.org/x/net
Get the golang.org/x/net package. In fact, it only The following steps are required:
mkdir -p $GOPATH/src/golang.org/x cd $GOPATH/src/golang.org/x git clone https://github.com/golang/net.git
This method can be used to obtain other packages under golang.org/x.
So I wrote a bash script here to install the golang.org/x package with one click
- Windows user git-bash to execute the gox.sh script
- *unix users first
chmod
##During the process of running the script, if git clone is too frequent, you need to enter your GitHub account.