Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2e075a7

Browse files
committedMar 28, 2023
errors: improve godoc for Join and Unwrap
Clarify how to deconstruct the error returned by errors.Join, and how Unwrap interacts with errors.Join.
1 parent c520693 commit 2e075a7

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 

Diff for: ‎src/errors/join.go

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ package errors
1010
// The error formats as the concatenation of the strings obtained
1111
// by calling the Error method of each element of errs, with a newline
1212
// between each string.
13+
//
14+
// A non-nil error returned by Join implements the Unwrap() []error method.
1315
func Join(errs ...error) error {
1416
n := 0
1517
for _, err := range errs {

Diff for: ‎src/errors/wrap.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
// type contains an Unwrap method returning error.
1313
// Otherwise, Unwrap returns nil.
1414
//
15-
// Unwrap returns nil if the Unwrap method returns []error.
15+
// Unwrap returns nil if the signature of err.Unwrap returns []error.
1616
func Unwrap(err error) error {
1717
u, ok := err.(interface {
1818
Unwrap() error

0 commit comments

Comments
 (0)
Please sign in to comment.