go执行go mod tidy时报错连接失败(go换依赖源)

报错:

go: cloud.google.com/go@v0.41.0: Get "https://proxy.golang.org/cloud.google.com/go/@v/v0.41.0.mod": dial tcp 142.251.43.17: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.

报错如上,大概就是安装依赖时从上述网址访问失败,一般是由于国内防火墙导致的,这个不可避免,所以可以用梯子,或者修改依赖获取的源,类似Python的换源,在cmd里面执行:

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

完成之后,再执行go mod tidy就很快了~

相关推荐

  1. go执行go mod tidy时报连接失败(go依赖)

    2024-03-22 14:56:01       38 阅读
  2. go依赖倒置demo

    2024-03-22 14:56:01       65 阅读
  3. Go依赖包管理

    2024-03-22 14:56:01       46 阅读
  4. Go语言中的init函数的执行时机

    2024-03-22 14:56:01       48 阅读
  5. go 语言实现依赖注入

    2024-03-22 14:56:01       51 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-22 14:56:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-22 14:56:01       101 阅读
  3. 在Django里面运行非项目文件

    2024-03-22 14:56:01       82 阅读
  4. Python语言-面向对象

    2024-03-22 14:56:01       91 阅读

热门阅读

  1. git 问题

    2024-03-22 14:56:01       47 阅读
  2. 基于PyTorch深度学习实战入门系列-PyTorch基础上

    2024-03-22 14:56:01       41 阅读
  3. python基础学习第一天

    2024-03-22 14:56:01       43 阅读
  4. 在Hive中使用Python编写的UDF函数

    2024-03-22 14:56:01       41 阅读
  5. Linux shell 命令中nohup 、&、重定向的使用

    2024-03-22 14:56:01       39 阅读
  6. 【Python】Python中装饰器和魔法方法的区别

    2024-03-22 14:56:01       47 阅读
  7. harmonyos:Socket连接

    2024-03-22 14:56:01       38 阅读