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`即可

转载于:https://www.cnblogs.com/wangyang0210/p/11202200.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值