Environment configuration method based on Go and Gin
- 2020-07-21 08:31:09
1. Download Go version officially and install the program of the corresponding platform.
2. Configure Go's environment variables:
GOROOT: GO installation path, for example GOROOT = D:\Go
GOPATH: project source directory (for example, GOPATH = E:\go), the directory below mainly includes three subdirectories, src, bin, pkg
GOBIN: bin directory, for example GOBIN = E:\go\bin
window platform add PATH path: %GOROOT%\bin; % % GOBIN
Specific environment variables can be viewed using go env:
C:\Users\rambo>go env set GOARCH=386 set GOBIN=E:\go\bin set GOEXE=.exe set GOHOSTARCH=386 set GOHOSTOS=windows set GOOS=windows set GOPATH=E:\go set GORACE= set GOROOT=D:\Program Files\Go set GOTOOLDIR=D:\Program Files\Go\pkg\tool\windows_386 set CC=gcc set GOGCCFLAGS=-m32 -mthreads -fmessage-length=0 set CXX=g++ set CGO_ENABLED=1
3. Install Gin, which requires over the wall. You can buy one ss.
Since you need to use go get, you must install git before using the command
go get gopkg.in/gin-gonic/gin.v1
ss on wnidow must configure proxy of git to connect to the external network, so first configure http and proxy of https:
git config --global http.proxy " socks5://127.0.0.1:1080 " git config --global https.proxy " socks5://127.0.0.1:1080 "
gin cannot be downloaded after this setting. In general, gopkg. in website URI will be redirected.
git config --global http.https://gopkg.in.followRedirects true
To accomplish this, we have also forgotten step 1. If we need to support https, we must be certified by ssl:
git config http.sslVerify true
If you have this many Settings, you can download Gin. Let's take a look at the configuration information of git:
git config --global --list
The results are as follows:
C:\Users\rambo>git config --global --list http.proxy=socks5://127.0.0.1:1080 http.sslverify=true https.proxy=socks5://127.0.0.1:1080 http.https://gopkg.in.followredirects=true