网站内容页模板,wordpress 调用页面,公司免费网站建设,贵港网站开发起因
有时候大家可能需要返回多个errors的场景#xff0c;所以这个时候可能就会考虑如何实现、怎么实现比较好
实现
package mainimport (errorsfmt
)func main() {errs : retErrors(hello,world)fmt.Println(errs)
}func retErrors(t…起因
有时候大家可能需要返回多个errors的场景所以这个时候可能就会考虑如何实现、怎么实现比较好
实现
package mainimport (errorsfmt
)func main() {errs : retErrors(hello,world)fmt.Println(errs)
}func retErrors(tst string) []error {var errs []errorif tst ! hello {errs append(errs, errors.New(err hello))}if tst ! world {errs append(errs, errors.New(err world))}return errs
}可以类似reterrors的实现并且做一些map去重list排序等处理让整体更加有序合理