国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

[Go 報(bào)錯(cuò)] go: go.mod file not found in current directory or any parent directory

這篇具有很好參考價(jià)值的文章主要介紹了[Go 報(bào)錯(cuò)] go: go.mod file not found in current directory or any parent directory。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

[Go 報(bào)錯(cuò)] go: go.mod file not found in current directory or any parent directory,golang,開發(fā)語言,后端

Build Error: go build -o c:\Users\13283\Desktop\godemo\__debug_bin3410376605.exe -gcflags all=-N -l .
go: go.mod file not found in current directory or any parent directory; see 'go help modules' (exit status 1)

原因分析:

go 的環(huán)境配置問題。與 golang 的包管理有關(guān)

處理方案:

如果你是 Windows 系統(tǒng),快捷鍵 “Win+R”,輸入cmd,打開終端。輸入:

go env -w GO111MODULE=auto

解釋:
GO111MODULE 是 Go 1.11 引入的新版模塊管理方式。

GO111MODULE 環(huán)境變量用于開啟或關(guān)閉 Go 語言中的模塊支持,它有 off、on、auto 三個(gè)可選值,默認(rèn)為 auto。

GO111MODULE=off
無模塊支持,go 會(huì)從 $GOPATH 文件夾和 vendor 目錄中尋找依賴項(xiàng)。

GO111MODULE=on
模塊支持,go 忽略 $GOPATH 文件夾,只根據(jù) go.mod 下載依賴。

GO111MODULE=auto
在 $GOPATH/src 外層且根目錄有 go.mod 文件時(shí),開啟模塊支持;否者無模塊支持
?

?文章來源地址http://www.zghlxwxcb.cn/news/detail-699934.html

到了這里,關(guān)于[Go 報(bào)錯(cuò)] go: go.mod file not found in current directory or any parent directory的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • go mod出現(xiàn)zip: not a valid zip file的解決辦法

    最近在準(zhǔn)備學(xué)習(xí)下kubernetes operator的開發(fā),在通過kubebuilder 腳手架創(chuàng)建operator項(xiàng)目時(shí),出現(xiàn)報(bào)錯(cuò): Error: failed to initialize project: unable to scaffold with \\\"base.go.kubebuilder.io/v4\\\": exit status 1 詳情如下: 問題原因:go mod代理服務(wù)器下載出錯(cuò);導(dǎo)致在下載時(shí)出現(xiàn)\\\": zip: not a valid zip file\\\" 通過 go

    2024年04月25日
    瀏覽(21)
  • python setup.py install報(bào)錯(cuò)“error: can‘t create or remove files in install directory”

    python setup.py install報(bào)錯(cuò)“error: can‘t create or remove files in install directory”

    問題描述: 在服務(wù)器上配置安裝pip時(shí)候缺少setuptools,安裝setuptools報(bào)錯(cuò): ? warnings.warn( error: can\\\'t create or remove files in install directory 有的朋友使用 即可解決。 但是,我使用了之后報(bào)錯(cuò) 右下角報(bào)錯(cuò)且讓我打開幫助: Troubleshoot Visual Studio Code Integrated Terminal launch failures ?這位騰騰任

    2024年02月06日
    瀏覽(20)
  • ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:報(bào)錯(cuò)處理
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:報(bào)錯(cuò)處理

    ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:報(bào)錯(cuò)處理 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:報(bào)錯(cuò)處理

    需要特別注意的是,安裝MNE時(shí)候需要注意環(huán)境,我的是激活tensorflow后安裝在相應(yīng)的文件夾之下的。而前面的括號(hào)(cat)是我給我的tensorflow命名的。不要在意這些細(xì)節(jié)了。哈哈。 安裝MNE工具包出現(xiàn)報(bào)錯(cuò): ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: \\\'d

    2024年02月13日
    瀏覽(27)
  • Mac下 Error “protoc-gen-go: program not found or is not executable“

    在Mac下使用protoc生成go代碼時(shí): 提示如下環(huán)境變量錯(cuò)誤: 插件安裝方式: 解決方案一(推薦): 使用Homebrew安裝所需插件: 檢查是否安裝成功: 解決方案二: 添加: 刷新環(huán)境變量:

    2024年02月11日
    瀏覽(23)
  • 導(dǎo)包bug,is not in std以及no non-test Go files in的處理

    導(dǎo)包bug,is not in std以及no non-test Go files in的處理

    一、在02那篇文章中我有提到這個(gè)is not in std這個(gè)錯(cuò)誤,這里我搞了好久才正常。 首先分析一下什么意思,它說我們的目標(biāo)文件包不存在,那么第一可能是我們的路徑錯(cuò)了,第二就是我們包的主從文件邏輯錯(cuò)了。 1.路徑就是我們src后面的路徑,那么代碼中引入的沒問題,就是我

    2024年02月06日
    瀏覽(20)
  • 使用go mod tidy命令出現(xiàn)go.mod file indicates go 1.21, but maximum supported version is 1.19,如何解決

    使用go mod tidy命令出現(xiàn)go.mod file indicates go 1.21, but maximum supported version is 1.19,如何解決

    使用git拉取代碼Golang代碼到本地后,利用VS Code打開項(xiàng)目后,看到go.mod報(bào)紅,現(xiàn)象如下圖所示:` 這個(gè)問題是當(dāng)前使用的go版本與git clone拉取下來的項(xiàng)目的go.mod所用的go版本不一致導(dǎo)致的: 在項(xiàng)目中打開一個(gè)terminal,查看當(dāng)前安裝的go版本是否與go.mod的第二行的聲明一致:如下圖

    2024年02月06日
    瀏覽(31)
  • 在 SHELL 腳本中調(diào)用另一個(gè) SHELL 腳本(報(bào)錯(cuò): go: not found)

    在 SHELL 腳本中調(diào)用另一個(gè) SHELL 腳本(報(bào)錯(cuò): go: not found)

    在Linux平臺(tái)上開發(fā),經(jīng)常會(huì)在console(控制臺(tái))上執(zhí)行另外一個(gè)腳本文件,經(jīng)常用的方法有:./my.sh 或 source my.sh 或 . my.sh;這三種方法有什么不同呢? 問題: A 腳本調(diào) B腳本,如下:sudo ./build.sh 報(bào)錯(cuò) B腳本中的 ./build.sh: 5: go: not found。 但是單獨(dú)運(yùn)行B腳本沒有問題。 問題分析: 這

    2024年02月13日
    瀏覽(26)
  • 安裝報(bào)錯(cuò):Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘\\METADATA‘

    安裝報(bào)錯(cuò):Could not install packages due to an OSError: [Errno 2] No such file or directory: ‘\\METADATA‘

    安裝指令: 報(bào)錯(cuò)如下: 解決方法: 按照?qǐng)?bào)錯(cuò)中的路徑 找到:“numpy-1.21.6.dist-info”并刪除 即可成功安裝:

    2024年02月11日
    瀏覽(28)
  • Docker報(bào)錯(cuò),No such file or directory

    Docker報(bào)錯(cuò),No such file or directory

    在按照網(wǎng)上教程嘗試將最簡單的Docker在Linux上運(yùn)行,但是一直報(bào)錯(cuò) 1. 以為是名稱不對(duì),博客里的運(yùn)行目錄為code,但是實(shí)際放在app里,所以把Dockfile里的運(yùn)行目錄改成了app 但是仍然找不到目錄 2. 相對(duì)路徑有時(shí)需要./而不是/,抱著試一試的想法在CMD里加上了這個(gè)(成功解決) 最

    2024年02月12日
    瀏覽(25)
  • git bash cd: ……not such file or directory的解決方式

    git bash cd: ……not such file or directory的解決方式

    問題描述: 我們?cè)趃it bash中想定位到指定目錄時(shí),通常會(huì)如下輸入: ?然后enter,出現(xiàn)錯(cuò)誤提示:No such file or directory……………… ?經(jīng)過小哥不斷試錯(cuò),成功找到解決方法,只需要將目錄上下級(jí)的分級(jí)符號(hào)“”改成“/”,即可,是不是意向不到的白癡問題…… ?。。。。。?/p>

    2024年02月11日
    瀏覽(47)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包