You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在 Go 语言中,errXXX 是一种命名约定,规定错误变量的名称应符合特定的格式。具体来说,错误变量应该以 err 开头,并后接一个描述性的名称。这种命名约定有助于提高代码的可读性和一致性,使其他开发者能够快速识别错误变量。
错误用法
// 定义一个错误变量,不符合 errXXX 命名约定varnewkszbZeroBwError=errors.New("this is a zero bandwidth error")
正确用法
// 符合命名约定的错误变量varerrZeroBandwidth=errors.New("this is a zero bandwidth error")
varErrZeroBandwidth=errors.New("this is a zero bandwidth error")
The text was updated successfully, but these errors were encountered:
wwcchh0123
changed the title
the variable name newkszbZeroBwError should conform to the errXxx format (errname)
the variable name XXXX should conform to the errXxx format (errname)
Nov 11, 2024
lint 解释
错误用法
正确用法
The text was updated successfully, but these errors were encountered: