exported const XXX should have comment or be unexported
exported var XXX should have comment or be unexported
可导出变量或常量XXX需要添加注释,(比如// XXX .),XXX后面要带一个空格+至少一个字符,这里为了简便使用空格+.
可导出变量就是首字符为大写的变量。
exported func XXX returns unexported type *cclua.tagLuaInfo, which can be annoying to use
可导出的函数XXX返回了一个未导出的类型(结构),将XXX首字符改为小写,或者将XXX的返回类型改为可导出(首字符大写)。
error strings should not be capitalized or end with punctuation or a newline
错误的字符串没有初始化或以标点或换行符结尾,比如errors.New("hey man,wtf!"),可以将最后的!号去掉即可消除该隐患。
should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
应该替换errors.New(fmt.Sprintf(...))为fmt.Errorf(...)
if block ends with a return statement, so drop this else and outdent its block
if语句块以return语句作为结尾,应该删除其else语句块部分并且反缩进该语句块,e.g:
arr := strings.Split(funcName, ".")
if len(arr) < 2 {
arr = strings.Split(funcName, ":")
if len(arr) < 2 {
return nil, fmt.Errorf("func[%v].no-exists", funcName)
} else {
result := make([]lua.LValue, len(args)+1)
result[0] = lua.LString("self")
for i := 0; i < len(args); i++ {
result[i+1] = args[i]
}
args = result
}
}
应该修改为:
arr := strings.Split(funcName, ".")
if len(arr) < 2 {
arr = strings.Split(funcName, ":")
if len(arr) >= 2 {
result := make([]lua.LValue, len(args)+1)
result[0] = lua.LString("self")
for i := 0; i < len(args); i++ {
result[i+1] = args[i]
}
args = result
} else {
return nil, fmt.Errorf("func[%v].no-exists", funcName)
}
}
a blank import should be only in a main or test package, or have a comment justifying it
e.g:
"fmt"
_ "github.com/go-sql-driver/mysql"
应该修改为:
"fmt"
// xxx
_ "github.com/go-sql-driver/mysql"
exported const XXXshould have comment (or a comment on this block) or be unexported
导出的常量需要有注释