踩坑 Go1.6+ install報錯go: go.mod file not found


最近在用go寫一個簡單的JVM虛擬機,在編譯的時候,使用go install,然后命令行提醒

go: go.mod file not found in current directory or any parent directory; see 'go help modules'

當前目錄或父目錄找不到go.mod文件

只要在你項目源碼目錄執行下面的命令就可以解決這個問題

go mod init

go會在這個目錄下,創建一個go.mod的文件。

再執行go install 就可以成功了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM