英文:
Download go packages via http proxy
问题
我正在尝试通过我的http_proxy下载Go包。
目前,我已经编辑了我的.gitconfig文件,内容如下:
[http]
proxyAuthMethod = basic
sslVerify = false
proxy = http://mydomain\\username:passwd@myproxy:8080
[credential "http://myproxy:8080"]
provider = generic
[https]
proxyAuthMethod = basic
sslVerify = false
proxy = http://mydomain\\username:passwd@myproxy:8080
通过代理克隆Git仓库可以正常工作(这意味着我的代理配置正确):
$ git clone https://github.com/ClickHouse/clickhouse-go.git -v
Cloning into 'clickhouse-go'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
warning: auto-detection of host provider took too long (>2000ms)
warning: see https://aka.ms/gcm/autodetect for more information.
POST git-upload-pack (185 bytes)
POST git-upload-pack (gzip 4262 to 2162 bytes)
remote: Enumerating objects: 7076, done.
remote: Counting objects: 100% (368/368), done.
remote: Compressing objects: 100% (116/116), done.
remote: Total 7076 (delta 258), reused 359 (delta 251), pack-reused 6708
Receiving objects: 100% (7076/7076), 2.52 MiB | 5.12 MiB/s, done.
Resolving deltas: 100% (4915/4915), done.
但是,当我尝试使用go mod tidy
添加Go模块时,我会遇到以下错误:
PS C:\Users\user\go\src> go mod tidy
go: finding module for package github.com/ClickHouse/clickhouse-go/v2
main imports
github.com/ClickHouse/clickhouse-go/v2: module github.com/ClickHouse/clickhouse-go/v2: Get "https://proxy.golang.org/github.com/%21click%21house/clickhouse-go/v2/@v/list": proxyconnect tcp: dial tcp: lookup http: no such host
我应该如何配置才能使go mod tidy
正常工作?
英文:
I'm trying to download go packages via my http_proxy.
For now, i've edited my .gitconfig and it looks like:
[http]
proxyAuthMethod = basic
sslVerify = false
proxy = http://mydomain\\username:passwd@myproxy:8080
[credential "http://myproxy:8080"]
provider = generic
[https]
proxyAuthMethod = basic
sslVerify = false
proxy = http://mydomain\\username:passwd@myproxy:8080
Git clone via proxy works fine (so it means my proxy works correctly):
$ git clone https://github.com/ClickHouse/clickhouse-go.git -v
Cloning into 'clickhouse-go'...
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
warning: auto-detection of host provider took too long (>2000ms)
warning: see https://aka.ms/gcm/autodetect for more information.
POST git-upload-pack (185 bytes)
POST git-upload-pack (gzip 4262 to 2162 bytes)
remote: Enumerating objects: 7076, done.
remote: Counting objects: 100% (368/368), done.
remote: Compressing objects: 100% (116/116), done.
remote: Total 7076 (delta 258), reused 359 (delta 251), pack-reused 6708
Receiving objects: 100% (7076/7076), 2.52 MiB | 5.12 MiB/s, done.
Resolving deltas: 100% (4915/4915), done.
But when i'm trying to add go modules with go mod tidy
i get this error:
PS C:\Users\user\go\src> go mod tidy
go: finding module for package github.com/ClickHouse/clickhouse-go/v2
main imports
github.com/ClickHouse/clickhouse-go/v2: module github.com/ClickHouse/clickhouse-go/v2: Get "https://proxy.golang.org/github.com/%21click%21house/clickhouse-go/v2/@v/list": proxyconnect tcp: dial tcp: lookup http: no such host
What should i configure so go mod tidy
would work?
答案1
得分: 1
你能确认你的代理设置是否符合预期吗?
尝试在控制台中输入 go env
并检查 GOPROXY
的值。
英文:
Can you confirm that your proxy is set to what you expect?
Try typing go env
in console and check the value of GOPROXY
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论