zoukankan      html  css  js  c++  java
  • 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:AppsGOPATHsrccode.oldboyedu.comstudygo>cd day01
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01>cd helloworld
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>go build
    go: go.mod file not found in current directory or any parent directory; see 'go help modules'
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>where go.exe
    D:AppsGoingo.exe
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>go.exe build
    go: go.mod file not found in current directory or any parent directory; see 'go help modules'
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>go env -w GO111MODULE=auto
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>go build
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>go version
    go version go1.17 windows/amd64
    
    D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>dir
     驱动器 D 中的卷没有标签。
     卷的序列号是 C61D-1F2E
    
     D:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld 的目录
    
    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:AppsGOPATHsrccode.oldboyedu.comstudygoday01helloworld>helloworld.exe
    Hello World!
    
    
  • 相关阅读:
    数据结构八树和森林
    数据结构 七 二叉树的遍历
    python 的 encode 、decode、字节串、字符串
    TCP/IP
    pg 数据库操作
    nginx + lua 的 跳转命令
    lua string 下的函数
    lua 的匹配规则
    nginx的 ngx.var ngx.ctx ngx.req
    docker 网络模式 和 端口映射
  • 原文地址:https://www.cnblogs.com/chenjo/p/15236619.html
Copyright © 2011-2022 走看看