Golang-错误大全

 

1
2
3
.\customerView.go:28:13: empty character literal or unescaped ' in character literal
.\customerView.go:34:12: empty character literal or unescaped ' in character literal
.\customerView.go:37:12: empty character literal or unescaped ' in character literal

 报错原因:声明空字符串变量用单引号时 

 

1
2
.\customerView.go:75:6: syntax error: unexpected main, expecting (
.\customerView.go:76:2: syntax error: unexpected var at end of statement

 报错原因:语法错误

 

1
..\service\customerService.go:26:37: invalid indirect of customer (type model.Customer)

 报错原因:传参类型错误,注意函数要求传的是值类型还是指针类型

 

1
TestaddUpper has malformed name: first letter after 'Test' must not be lowercase

 报错原因:测试函数命名不规范 比如:TestaddUpper  应该改为 TestAddUpper

 

1
fatal error: concurrent map writes

 报错原因:并发写操作。开启多个协程的时候如果没有处理好资源机制就会报该错。解决方案1、加互斥锁(存在一个等待时间的问题),2、channel

 

1
go mod init: modules disabled by GO111MODULE=off; see 'go help modules'

 go mod管理包,set GO111MODULE=on   window 得用管理员才能更改

 
1
2
3
4
5
6
type MenberDao struct {
    *tool.Orm
}
初始化
dao.MenberDao{ tool.DbEngine }<br>
会出现警告:composite literal uses unkeyed fields

  原因:结构体无键字段初始化,就会警告

 

posted @   爱跑步的乌龟  阅读(1329)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示