qiniu / reviewbot

Empower Your Code Quality with Self-Hosted Automated Analysis and Review
https://reviewbot-x.netlify.app
Apache License 2.0
35 stars 15 forks source link

Error return value of `XXXX` is not checked (errcheck) #436

Open wwcchh0123 opened 2 weeks ago

wwcchh0123 commented 2 weeks ago

lint 解释

错误用法

func testfunc(){
    return err
}
func main() {
    // 未进行错误校验
    testfunc()
    // .....
    // ......
}

正确用法


func main() {
    // 进行错误校验
    err := testfunc()
    if err != nil {
        // 处理错误
        return
    }
    // .....
    // ......
}