当前位置:网站首页>【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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
猜你喜欢
Bulk free text translation
MySql的安装配置超详细教程与简单的建库建表方法
银河麒麟高级服务器v10 sp1 手动加载Raid卡驱动
深度解析 z-index
外贸网站优化-外贸网站优化教程-外贸网站优化软件
《白帽子说Web安全》思维导图
服务器硬件及RAID配置实战
零样本学习&Domain-aware Visual Bias Eliminating for Generalized Zero-Shot Learning
Explain the example + detail the difference between @Resource and @Autowired annotations (the most complete in the entire network)
【云原生】-Docker安装部署分布式数据库 OceanBase
随机推荐
【编程题】【Scratch三级】2022.03 冬天下雪了
Jobject 使用
(border-box) The difference between box model w3c and IE
Exam Questions Previous True Questions Wrong Bills [The Fourth Session] [Provincial Competition] [Group B]
CHI论文阅读(1)EmoGlass: an End-to-End AI-Enabled Wearable Platform for Enhancing Self-Awareness of Emoti
DHCP原理与配置
零样本学习&Domain-aware Visual Bias Eliminating for Generalized Zero-Shot Learning
Foreign trade website optimization - foreign trade website optimization tutorial - foreign trade website optimization software
文件 - 03 下载文件:根据文件id获取下载链接
shell脚本 -d 是目录文件,那么-e,-f等说明
银河麒麟服务器v10 sp2安装oracle19c
Obtaining server and client information
LVM和磁盘配额
浅析v-model语法糖的实现原理与细节知识及如何让你开发的组件支持v-model
MySQL笔记下
【TA-霜狼_may-《百人计划》】美术2.3 硬表面基础
Database Principles Homework 2 — JMU
Log4net 思维导图
浅析重复线性渐变repeating-linear-gradient如何使用
Core Tower Electronics won the championship in the Wuhu Division of the 11th China Innovation and Entrepreneurship Competition