36
Go 语言解决不能Go get安装Gin问题解决方案 | 梦遥奇缘
source link: https://www.idiot6.com/2019/07/23/go-gin-golang-x/?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Go 语言解决不能Go get安装Gin问题解决方案
1.问题描述
Go get 出现超时问题:“golang unrecognized import path "golang.org/x/net unrecognized import path "golang.org/x/sys" Unknown SSL protocol error in connection to gopkg.in:443 "” |
2.解决办法
- 网络上解决方案1手动下载:mkdir $GOPATH/src/golang.org/xcd $GOPATH/src/golang.org/xgit clone [email protected]:golang/text.git
方案二:设置代理
3.最佳解决方案
从 Go 1.11 版本开始已经开始支持Go Mod ,并且提供了包下载的解决方案,就是使用 https://goproxy.io/ 直接代理下载,官方设置方法:
macos/linux
export GO111MODULE=on export GOPROXY=https://goproxy.io |
- Wins 使用PowerShell 设置(这里输入是去当前设置的GOPATH)
$env:GO111MODULE="on" $env:GOPROXY="https://goproxy.io" |
- 提示这里需要加入引号,否则会报on或地址有问题,之后在执行Go get 等其他命令都一帆风顺了。
Notice: 如果你使用的Go version 》=1.13 请使用
go env -w GOPROXY=https://goproxy.io,direct go env -w GOPRIVATE=*.corp.example.com |
Go 成功安装Gin框架并使用Go mod管理
安装Gin框架并使用GoRecommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK