• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Go——报错总结

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

前端时间抽时间看完了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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
vscode中go代码自动补全发布时间:2022-07-10
下一篇:
Go 验证是否字符串包含中文发布时间:2022-07-10
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap