Goland使用手册(1)
一、场景描述
github上pull了一个go语言的项目,使用JetBrains的goland工具进行二次开发,项目打开后terminal窗口报如下异常:
go: downloading go1.23.9 (windows/amd64)
go: download go1.23.9: golang.org/toolchain@v0.0.1-go1.23.9.windows-amd64: Get "https://proxy.golang.org/golang.org/toolchain/@v/v0.0.1-go1.23.9.windows-amd64.zip": dial tcp 142.250.217.113:443: connectex: 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.
二、问题分析
这个错误表明 Go 在下载 Go 1.23.9 工具链时无法连接到 Golang 的官方代理(proxy.golang.org),导致网络超时。这是国内用户使用 Go 时的常见问题,主要因为网络限制或 DNS 解析问题。
三、解决方案
我笔记本是windows系统,打开【系统环境变变量配置】,增加【GOPROXY】变量配置,内容如下:
https://goproxy.cn,direct
四、结果验证
五、一些变量的解读
- GOROOT:表示源码包所在路径;
- GOPATH:开发者go项目的默认路径;
- Go Modules:模块管理系统,用于解决依赖管理问题。