SoFunction
Updated on 2025-03-05

Environment configuration method based on Go and Gin

1. Officially download the Go version and install the programs of the corresponding platform.

2. Configure Go's environment variables:

GOROOT: GO installation path, for example GOROOT = D:\Go

GOPATH: The directory where the project source code is located (for example, GOPATH = E:\go). This directory mainly includes three subdirectories, namely src, bin, and pkg

GOBIN: bin directory, for example GOBIN = E:\go\bin

Add PATH path to the window platform: %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, this requires passing the wall, you can buy a ss.

Because you need to use go get, you must install git. After the installation is completed, use the command

go get /gin-gonic/gin.v1

Ss must configure git proxy on wnidow to connect to the external network, so first configure http and https proxy:

git config --global  “socks5://127.0.0.1:1080”

git config --global  “socks5://127.0.0.1:1080”

This way, it is still impossible to download gin. Generally, you will encounter the problem of website URI redirection. You can set support for redirection:

git config --global :// true

After completing these, we also forgot a step. If we need to support https, we must pass SSL authentication:

git config  true

Set up so many settings. If everything goes well, you can download Gin. Let’s take a look at the configuration information of git just now:

git config --global --list

The results are as follows:

C:\Users\rambo>git config --global --list
=socks5://127.0.0.1:1080
=true
=socks5://127.0.0.1:1080
://=true

The above environment configuration method based on Go and Gin is all the content I have shared with you. I hope you can give you a reference and I hope you can support me more.