CherieLi Student

Go

2023-12-22

https://cloud.tencent.com/developer/article/2037535 Go 语言怎么优化重复的 if err != nil 样板代码?

func CheckErrors (err error) {
    if err != nil {
        return err
    }
}

err := SomeMethod()
CheckErrors(err)

上一篇 Wookpool

下一篇 重构

Comments

Content