go.mod file not found in current directory or any parent directory; see 'go help modules'
go的环境设置问题,执行
go env -w GO111MODULE=auto
我的环境:Windows 7, Go 1.17
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo>cd day01
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01>cd helloworld
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>go build
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>where go.exe
D:\Apps\Go\bin\go.exe
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>go.exe build
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>go env -w GO111MODULE=auto
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>go build
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>go version
go version go1.17 windows/amd64
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>dir
驱动器 D 中的卷没有标签。
卷的序列号是 C61D-1F2E
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld 的目录
2021/09/06 21:52 <DIR> .
2021/09/06 21:52 <DIR> ..
2021/09/06 21:52 1,925,120 helloworld.exe
2021/09/06 21:41 79 main.go
2 个文件 1,925,199 字节
2 个目录 71,544,717,312 可用字节
D:\Apps\GOPATH\src\code.oldboyedu.com\studygo\day01\helloworld>helloworld.exe
Hello World!
go.mod file not found in current directory or any parent directory; see 'go help modules'的更多相关文章
- Understanding go.sum and go.mod file in Go
https://golangbyexample.com/go-mod-sum-module/ Understanding go.sum and go.mod file in Go (Golang) – ...
- Docker: adding a file from a parent directory
17down votefavorite 4 In my Dockerfile I've got : ADD ../../myapp.war /opt/tomcat7/webapps/ That fil ...
- 12C数据库ORA-40365: The SYS user cannot be locked while the password file is in its current format
[环境介绍] 系统环境:Solaris + Oracle 12CR2 [背景描述] 基于集团数据库安全检查项,需要把sys用户锁定或者修改复杂口令整改. 在整改前已经对参数remote_login ...
- The directory '/home/stone/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If execu
使用sudo pip install ......的时候出现下面一段黄色的代码: The directory '/home/stone/.cache/pip/http' or its parent d ...
- 【解决了一个小问题】golang中引用一个路径较长的库,导致goland中出现"module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2"
在项目中的go.mod文件中有这样一句: require ( github.com/xxx-devops/xx1/sdk/go v2.2.3 ) 项目的编译没有问题,但是goland中出现如下提示: ...
- mac brew 安装php扩展报错:parent directory is world writable but not sticky
$ brew install php70-mcrypt 报错: Error: parent directory is world writable but not sticky 搜索到github的答 ...
- Error: parent directory is world writable but not sticky
在本地安装pyenv的时候,出现了如下的报错: ➜ brew install pyenv ==> Downloading https://github.com/yyuu/pyenv/archiv ...
- C#基础精华04(文件流,文件操作,File、Directory、Path,Directory)
文件流 FileStream 可读可写 大文件 释放 StreamReader 读取 释放 StreamWriter 写入 释放 using 中释放 File 可读可写 小文件 操作文 ...
- go 连接MSSQLServer数据库【遇到的坑】
前言:项目测试需要用到mssqlserver数据库连接,遇到坑,自己爬直接上代码: package main import ( "database/sql" " ...
随机推荐
- 【C/C++】函数的默认参数/函数的占位参数/函数重载/注意事项
函数的默认参数 返回值类型 函数名(参数=默认值){} #include <iostream> using namespace std; int func(int a = 10, int ...
- 【HarmonyOS】【xml】使用xml绘制视频播放控制栏
本文记录HarmonyOS使用xml绘制视频播放控制栏 效果图如下 代码如下 点击查看代码 <?xml version="1.0" encoding="utf-8& ...
- 在【自定义列】中编辑简单运算公式(Power Query 之 M 语言)
数据源: "品名"."数量"."单价"三列 目标: 计算销售单价(单价*1.2) 解决方案: 在[自定义列]中使用乘法四则运算 步骤: 打开 ...
- 在eclipse打开jsp文件变成文本的解决:
在eclipse打开jsp文件变成文本的解决: ------原因:可能是不小心删除某些组件等等一些操作 1,考虑一下是否还有插件jsp 编辑器组件 选择内部编辑器[在下面选择 JSP Editor]- ...
- C++ 11 新特性:函数声明auto
1.概览 1.1 函数名中的箭头,用来表明函数的return type,其使用在函数的返回类型需要通过模板参数进行推导,使用在decltype()和declval()不方便的场景 2.正文 c++ 中 ...
- 在mysql5.8中用json_extract函数解析json
背景:某个字段的数据中是JSON,需要提取其中的卡号部分,如: {"objType":"WARE","orderId":6771254073 ...
- C#验证对象中的属性是否为空的共通方法
在后台接口处理时,经常需要对请求的参数做验证.因此提取了共通方法,方便进行判断. /// <summary> /// 数据验证工具类 /// </summary> public ...
- 【LeetCode】1433. 检查一个字符串是否可以打破另一个字符串 Max Difference You Can Get From Changing an Integer
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 排序 日期 题目地址:https://leetcode ...
- 【LeetCode】422. Valid Word Square 解题报告(C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 拼接出每一列的字符串 日期 题目地址:https:// ...
- 【LeetCode】865. Smallest Subtree with all the Deepest Nodes 解题报告(Python & C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 日期 题目地址:https://leetcode.c ...