解决goland module代理无法访问
Posted zisefeizhu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决goland module代理无法访问相关的知识,希望对你有一定的参考价值。
解决goland module代理无法访问
问题如下
D:projectdemo1main>go run main.go
go: finding module for package github.com/sirupsen/logrus
main.go:4:2: module github.com/sirupsen/logrus: Get "https://proxy.golang.org/github.com/sirupsen/logrus/@v/list": dial tcp 172.217.27.145:443: connectex: A conn
ection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has fa
iled to respond.
分析上述报错可以看出是因为代理没有起作用的原因导致的
目录结构如下
package main
import (
log "github.com/sirupsen/logrus"
)
func main() {
log.WithFields(log.Fields{
"animal": "walrus",
}).Info("A walrus appears")
}
go.mod
module main
go 1.14
解决问题
ain>go env -w GOPROXY=https://goproxy.cn
再次执行
D:projectdemo1main>go run main.go
go: finding module for package github.com/sirupsen/logrus
go: downloading github.com/sirupsen/logrus v1.6.0
D:projectdemo1main>go mod init main
go mod init: go.mod already exists
成功
D:projectdemo1main>go run main.go
time="2020-07-25T21:17:02+08:00" level=info msg="A walrus appears" animal=walrus
??!
以上是关于解决goland module代理无法访问的主要内容,如果未能解决你的问题,请参考以下文章
Forge Viewer - 如何在场景中访问(或获取渲染/片段代理)克隆的网格?