Kevin Wan 3 vuotta sitten
vanhempi
sitoutus
b215fa3ee6
2 muutettua tiedostoa jossa 9 lisäystä ja 7 poistoa
  1. 3 3
      ROADMAP.md
  2. 6 4
      core/errorx/batcherror.go

+ 3 - 3
ROADMAP.md

@@ -20,9 +20,9 @@ We hope that the items listed below will inspire further engagement from the com
 - [x] Support `goctl bug` to report bugs conveniently
 
 ## 2022
-- [ ] Support `goctl mock` command to start a mocking server with given `.api` file
-- [ ] Add `httpx.Client` with governance, like circuit breaker etc.
-- [ ] Support `goctl doctor` command to report potential issues for given service
 - [x] Support `context` in redis related methods for timeout and tracing
 - [x] Support `context` in sql related methods for timeout and tracing
 - [ ] Support `context` in mongodb related methods for timeout and tracing
+- [ ] Add `httpx.Client` with governance, like circuit breaker etc.
+- [ ] Support `goctl doctor` command to report potential issues for given service
+- [ ] Support `goctl mock` command to start a mocking server with given `.api` file

+ 6 - 4
core/errorx/batcherror.go

@@ -11,10 +11,12 @@ type (
 	errorArray []error
 )
 
-// Add adds err to be.
-func (be *BatchError) Add(err error) {
-	if err != nil {
-		be.errs = append(be.errs, err)
+// Add adds errs to be, nil errors are ignored.
+func (be *BatchError) Add(errs ...error) {
+	for _, err := range errs {
+		if err != nil {
+			be.errs = append(be.errs, err)
+		}
 	}
 }