Home  >  Article  >  Backend Development  >  About go get timeout problem

About go get timeout problem

藏色散人
藏色散人forward
2021-02-05 15:32:054062browse

The following is an introduction to go get timeout from the golang tutorial column, I hope it will be helpful to friends in need!

About go get timeout problem

  • Consider it a proxy problem

Set the first proxy
Proxy address

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct

# 设置不走 proxy 的私有仓库,多个用逗号相隔(可选)
go env -w GOPRIVATE=*.corp.example.com

# 设置不走 proxy 的私有组织(可选)
go env -w GOPRIVATE=example.com/org_name

No The download was successful, so using the second

proxy address

$ go env -w GO111MODULE=on
$ go env -w GOPROXY=https://goproxy.cn,direct

was useless. Read the error message carefully!

go get gorm.io/gorm: gorm.io/gorm@v1.20.12: verifying module: gorm.io/gorm@v1.20.12: Get "https://sum.golang.org/lookup/gorm.io/gorm@v1.20.12": dial tcp 216.58.200.49:443: co
nnectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has
failed to respond.

It turns out that because Go 1.13 sets the default GOSUMDB=sum.golang.org, this website is blocked. It is used to verify the validity of the package. It can be closed with the following command:

go env -w GOSUMDB=off

You can set

GOSUMDB="sum.golang.google.cn"

, which is a sum verification service specially provided for China.

goenv-w GOSUMDB="sum.golang.google.cn

-w flag requires one or more parameters of the form NAME=VALUE and overrides the default settings

The above is the detailed content of About go get timeout problem. 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