当前位置:网站首页>【Go报错】go go.mod file not found in current directory or any parent directory 错误解决
【Go报错】go go.mod file not found in current directory or any parent directory 错误解决
2022-07-31 05:50:00 【饿饿好饿】
场景:
安装好 liteide 之后创建了第一个 “hello world” 的golang 项目,却报了如下错误。
问题描述:

报错:
D:/golang/bin/go.exe build [C:/Users/dell/go/src/hello]
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
错误: 进程退出代码 1.
原因分析:
go 的环境配置问题。与 golang 的包管理有关。
解决方案:
如果你是 Windows 系统,快捷键 “Win+R”,输入cmd,打开终端。输入:
go env -w GO111MODULE=auto
解释:
GO111MODULE 是 Go 1.11 引入的新版模块管理方式。
GO111MODULE 环境变量用于开启或关闭 Go 语言中的模块支持,它有 off、on、auto 三个可选值,默认为 auto。
GO111MODULE=off
无模块支持,go 会从 $GOPATH 文件夹和 vendor 目录中寻找依赖项。GO111MODULE=on
模块支持,go 忽略 $GOPATH 文件夹,只根据 go.mod 下载依赖。GO111MODULE=auto
在 $GOPATH/src 外层且根目录有 go.mod 文件时,开启模块支持;否者无模块支持。
参考链接
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- 2. (1) Chained storage of stack, operation of chain stack (illustration, comment, code)
- 文件 - 04 下载文件: 根据文件下载链接下载文件
- codec2 BlockPool:unreadable libraries
- nohup principle
- Chapter 16: Constructing the Magic Square for Prime Numbers of Order n(5,7)
- 多进程全局变量失效、变量共享问题
- 科普 | “大姨太”ETH 和 “小姨太”ETC的爱恨情仇
- codec2 BlockPool:不可读库
- Difficulty comparison between high concurrency and multithreading (easy to confuse)
- 2.(1)栈的链式存储、链栈的操作(图解、注释、代码)
猜你喜欢

Project exercise - memorandum (add, delete, modify, check)

讲解实例+详细介绍@Resource与@Autowired注解的区别(全网最全)

Foreign trade website optimization - foreign trade website optimization tutorial - foreign trade website optimization software

文件 - 04 下载文件: 根据文件下载链接下载文件

高并发与多线程之间的难点对比(容易混淆)

(border-box)盒子模型w3c、IE的区别

【编程题】【Scratch三级】2022.03 冬天下雪了

Postgresql source code learning (34) - transaction log ⑩ - full page write mechanism

搭建zabbix监控及邮件报警(超详细教学)

Core Tower Electronics won the championship in the Wuhu Division of the 11th China Innovation and Entrepreneurship Competition
随机推荐
nohup原理
MySql的安装配置超详细教程与简单的建库建表方法
cp 的用法
Automatic translation software - batch batch automatic translation software recommendation
CHI论文阅读(1)EmoGlass: an End-to-End AI-Enabled Wearable Platform for Enhancing Self-Awareness of Emoti
shell脚本 -d 是目录文件,那么-e,-f等说明
银河麒麟服务器v10 sp1安装.net6
mysql的下载及安装使用
Gradle remove dependency demo
Foreign trade website optimization - foreign trade website optimization tutorial - foreign trade website optimization software
iOS大厂面试查漏补缺
Some derivation formulas for machine learning backpropagation
HuffmanTree
浅析伪类和伪元素
SQL Server Datetime2数据类型
浅层了解欧拉函数
熟悉而陌生的新朋友——IAsyncDisposable
One of the small practical projects - food alliance ordering system
银河麒麟服务器v10 sp2安装oracle19c
What is float?What is document flow?Several ways and principles of clearing floats?What is BFC, how to trigger BFC, the role of BFC