Home  >  Article  >  Backend Development  >  Detailed explanation of golang.org/x one-click installation script

Detailed explanation of golang.org/x one-click installation script

藏色散人
藏色散人forward
2021-02-28 16:13:323132browse

The following is the tutorial column of golang to introduce the golang.org/x one-click installation script. I hope it will be helpful to friends in need!

golang.org/xOne-click installation script

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 as https:// github.com/golang/net is the mirror library of https://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 firstchmod ##During the process of running the script, if git clone is too frequent, you need to enter your GitHub account.

The above is the detailed content of Detailed explanation of golang.org/x one-click installation script. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete