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" " ...
随机推荐
- MySQL批量数据脚本示例
一.建表 # 新建库 create database bigData; use bigData; #1 建表dept CREATE TABLE dept( id INT UNSIGNED PRIMAR ...
- sftp 上传下载 命令介绍
sftp是Secure FileTransferProtocol的缩写,安全文件传送协议.可以为传输文件提供一种安全的加密方法. sftp与 ftp有着几乎一样的语法和功能.SFTP为 SSH的一部分 ...
- 玩转 Mockjs,前端也能跑的很溜
mockjs作用就是,生成随机模拟数据,拦截 ajax 请求,可以对数据进行增删改查.在生成数据时,我们就需要能够熟练使用 mock.js 的语法. Mockjs 的语法规范包括两部分:数据模板定 ...
- Jenkins pipeline声明式语法
目录 一.最简结构 二.简单例子 一.最简结构 pipeline { agent any stages { stage('pull') { st ...
- [BUUCTF]REVERSE——Java逆向解密
Java逆向解密 附件 步骤: 根据题目提示是java语言编写的程序,用jd-gui反编译一下 百度了一些java里的函数后读懂了这段程序的意思,将我们输入的字符串依次+'@',然后跟32异或,得到K ...
- 延时间隔(Project)
<Project2016 企业项目管理实践>张会斌 董方好 编著 像"饭前洗手"这种事,绝大部分情况下,是洗完手马上就可以动筷子开吃,但总会有意外,比如手都洗好了,突然 ...
- 突破结构限制的“数据透视表”(Excel技巧集团)
出个题:根据A2:C16生成E2:G18的汇总结果.这里的汇总是求和. 遇到这种情况,首选肯定是函数公式,虽然数据源表是个很规范的一维表,可以用数据透视表,可是想建构到上图那么奇葩,数据透视表无此异能 ...
- Linux 输入指令显示 command not found(未找到命令)解决办法
问题摘要:当我在linux中安装了一个Nginx,最后需要检查是否安装成功的时候,输入了Nginx -v 提示未找到命令(服务器中英文提示为 command not found) 其他软件命令未找到问 ...
- SQL Server日志恢复还原数据
通过日志还原,首先要注意的是: 1,在数据库更新和删除之前有一个完整的备份. 2,在更新和删除之后,做一个日志备份. 3,该日志只能用于还原数据库备份和日志备份时间之间的数据. 下面看整个数据库备份和 ...
- Java不可变类与final类
概念 Java的不可变类是指八个基础类型的包装类和String,他们的数据成员是不可变的.使用加法等操作时,其实是创建了一个新的对象. Java的final类是对类用关键字final进行修饰,说明该类 ...