Home >Backend Development >Golang >What should I do if the domestic go get installation prompt times out? (Attached is the solution)

What should I do if the domestic go get installation prompt times out? (Attached is the solution)

藏色散人
藏色散人forward
2021-10-19 15:24:313250browse

This article is provided by the go language tutorial column to share with you how to install Go Gin to solve the problem of domestic go get installation timeout. I hope it will be helpful to friends in need!

1. In China, if you directly use the following command recommended by the official website, the installation will most likely be unsuccessful.

CentOS 7 OCI 8 安装

At this time, you can execute the following steps in your project directory. A command

go env -w GO111MODULE=on 
go env -w GOPROXY=https://goproxy.cn,direct//这个一定要写你自己的项目go mod init YourProjectName
go get -u github.com/gin-gonic/gin

You can now quote it directly

package mainimport "github.com/gin-gonic/gin"func main() {
    r := gin.Default()
    r.GET("/ping")}

If you still can’t quote it, check the box below

What should I do if the domestic go get installation prompt times out? (Attached is the solution)

The above is the detailed content of What should I do if the domestic go get installation prompt times out? (Attached is the solution). 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