Go——報錯總結


前言

前端時間抽時間看完了Go基礎的一些內容,后面接着學習,記錄一些錯誤。

錯誤

cannot refer to unexported name fmt.println

報錯信息:

# basic
.\main.go:6:2: cannot refer to unexported name fmt.println    //不能夠引用未導出的名稱fmt.println
.\main.go:6:2: undefined: fmt.println    //未定義的:fmt.println

原因:

嗯,Go中其實有規定的就是模塊中要導出的函數,必須首字母大寫,所以錯誤的原因就是fmt.Println()寫成了fmt.println()

bee報錯

### 錯誤代碼-0001
Administrator@King MINGW64 /d/wamp/www/GoLearn/src/myapp
$ bee run myapp
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2019/07/23 16:23:35 FATAL    ▶ 0001 No application 'D:\wamp\www\GoLearn\src\myapp\myapp' found in your GOPATH


### 錯誤代碼-0003
$ bee run myapp/
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2019/07/23 16:25:50 INFO     ▶ 0001 Using 'myapp' as 'appname'
2019/07/23 16:25:50 INFO     ▶ 0002 Initializing watcher...
can't load package: package .: no Go files in D:\wamp\www\GoLearn\src
2019/07/23 16:25:50 ERROR    ▶ 0003 Failed to build the application: can't load package: package .: no Go files in D:\wamp\www\GoLearn\src

原因: 
> 報錯里面的提示很清楚,所有修改GOPATH或者進入到應用目錄直接`bee run`


### 錯誤代碼-0003
Administrator@King MINGW64 /d/wamp/www/GoLearn/src/myapp
$ bee run
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.10.0
2019/07/23 16:26:43 INFO     ▶ 0001 Using 'myapp' as 'appname'
2019/07/23 16:26:43 INFO     ▶ 0002 Initializing watcher...
main.go:5:2: cannot find package "github.com/astaxie/beego" in any of:
        D:\Program Files\Go\src\github.com\astaxie\beego (from $GOROOT)
        D:\wamp\www\GoLearn\src\github.com\astaxie\beego (from $GOPATH)
2019/07/23 16:26:44 ERROR    ▶ 0003 Failed to build the application: main.go:5:2: cannot find package "github.com/astaxie/beego" in any of:
        D:\Program Files\Go\src\github.com\astaxie\beego (from $GOROOT)
        D:\wamp\www\GoLearn\src\github.com\astaxie\beego (from $GOPATH)

>缺少對應的引入文件`github.com/astaxie/beego`,重新`go get github.com/astaxie/beego`即可

go get 報錯 cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

報錯信息:

D:\wamp\www\GoLearn>go get github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in

原因:

GCC編譯器版本不是64位的,訪問https://sourceforge.net/projects/mingw-w64/下載個64位的把環境變量配置好,安裝教程https://www.cnblogs.com/findumars/p/8289669.html


免責聲明!

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



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