Skip to content

Commit

Permalink
Merge pull request #30 from peczenyj/fix-errors-join-2
Browse files Browse the repository at this point in the history
fix: errors.Join defined for go1.19 or below will not work using unsafe.String
  • Loading branch information
ernado authored Dec 13, 2023
2 parents 10bc51a + 40c4e14 commit a3f192e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 60 deletions.
59 changes: 0 additions & 59 deletions join.go

This file was deleted.

14 changes: 13 additions & 1 deletion join_go120.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ package errors

import "errors"

var Join = errors.Join
// Join returns an error that wraps the given errors.
// Any nil error values are discarded.
// Join returns nil if every value in errs is nil.
// The error formats as the concatenation of the strings obtained
// by calling the Error method of each element of errs, with a newline
// between each string.
//
// A non-nil error returned by Join implements the Unwrap() []error method.
//
// Available only for go 1.20 or superior.
func Join(errs ...error) error {
return errors.Join(errs...)
}
3 changes: 3 additions & 0 deletions join_test.go → join_go120_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build go1.20
// +build go1.20

package errors_test

import (
Expand Down

0 comments on commit a3f192e

Please sign in to comment.