Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove support to join to older go version #29

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,22 @@ func TestErrorFormatter(t *testing.T) {
detailed{},
}
nonascii = &wrapped{"café", nil}
newline = &wrapped{"msg with\nnewline",
&wrapped{"and another\none", nil}}
newline = &wrapped{
"msg with\nnewline",
&wrapped{"and another\none", nil},
}
fallback = &wrapped{"fallback", os.ErrNotExist}
oldAndNew = &wrapped{"new style", formatError("old style")}
framed = &withFrameAndMore{
frame: errors.Caller(0),
}
opaque = &wrapped{"outer",
errors.Opaque(&wrapped{"mid",
&wrapped{"inner", nil}})}
opaque = &wrapped{
"outer",
errors.Opaque(&wrapped{
"mid",
&wrapped{"inner", nil},
}),
}
)
testCases := []struct {
err error
Expand Down Expand Up @@ -89,7 +95,7 @@ func TestErrorFormatter(t *testing.T) {
fmt: "%+v",
want: "something:" +
"\n github.com/go-faster/errors_test.TestErrorFormatter" +
"\n .+/format_test.go:30" +
"\n .+/format_test.go:32" +
"\n something more",
regexp: true,
}, {
Expand Down
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.
//
// Only available on go 1.20.x 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
Loading