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

藏色散人
Release: 2021-10-19 15:25:05
forward
3219 people have browsed it

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 安装
Copy after login

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
Copy after login

You can now quote it directly

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

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!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template