Go——报错总结

2024-08-16 12:22:42 浏览数 (3)

前言

前端时间抽时间看完了Go基础的一些内容,后面接着学习,记录一些错误。

错误

cannot refer to unexported name fmt.println

报错信息:

代码语言:javascript复制
# 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报错

代码语言:javascript复制
### 错误代码-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:wampwwwGoLearnsrcmyappmyapp' 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:wampwwwGoLearnsrc
2019/07/23 16:25:50 ERROR    ▶ 0003 Failed to build the application: can't load package: package .: no Go files in D:wampwwwGoLearnsrc

原因: 
> 报错里面的提示很清楚,所有修改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 FilesGosrcgithub.comastaxiebeego (from $GOROOT)
        D:wampwwwGoLearnsrcgithub.comastaxiebeego (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 FilesGosrcgithub.comastaxiebeego (from $GOROOT)
        D:wampwwwGoLearnsrcgithub.comastaxiebeego (from $GOPATH)

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

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

报错信息:

代码语言:javascript复制
D:wampwwwGoLearn>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

0 人点赞