Skip to content

Commit

Permalink
fix(Cloud Databases): fix Unwrap return value for go 1.18 compat
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Hemard <alexhemard@gmail.com>
  • Loading branch information
alexhemard authored and Alex Hemard committed Dec 14, 2023
1 parent cb423dc commit 6737d84
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ibm/service/database/resource_ibm_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,21 @@ func (e *databaseUserValidationError) Error() string {
if i > 0 {
b = append(b, '\n')
}
b = append(b, err.Error()...)
if err != nil {
b = append(b, err.Error()...)
}
}

return fmt.Sprintf("database user (%s) validation error:\n%s", e.user.Username, string(b))
}

func (e *databaseUserValidationError) Unwrap() []error {
return e.errs
func (e *databaseUserValidationError) Unwrap() error {
if e == nil || len(e.errs) == 0 {
return nil
}

// only return the first
return e.errs[0]
}

type userChange struct {
Expand Down

0 comments on commit 6737d84

Please sign in to comment.