Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Don't defer Close() on writable files. Parent comment
You could write your own errorsJoin() and change Error() method to suit your needs.
But really in this particular scenario you would be better served by something like:
func errorsConcat(err1 error, err2 error) error { if (err1) { return err1; } return err2; }
In the scenario described in this article, errors.Join() would most often reduce to that (in terms of what Error() string would produce).
There are no comments on this comment yet.
You could write your own errorsJoin() and change Error() method to suit your needs.
But really in this particular scenario you would be better served by something like:
And then do: err = errorsConcat(err, f.Close())In the scenario described in this article, errors.Join() would most often reduce to that (in terms of what Error() string would produce).