Skip to content

Commit 81fde8d

Browse files
author
Dean Karn
authored
fix chaining recursive issue (#20)
1 parent 0ca5836 commit 81fde8d

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
test:
99
strategy:
1010
matrix:
11-
go-version: [1.18.x]
11+
go-version: [1.18.x, 1.21.0]
1212
os: [ubuntu-latest, macos-latest, windows-latest]
1313
runs-on: ${{ matrix.os }}
1414
steps:
@@ -37,9 +37,9 @@ jobs:
3737
steps:
3838
- uses: actions/setup-go@v3
3939
with:
40-
go-version: 1.18.x
40+
go-version: 1.21.x
4141
- uses: actions/checkout@v3
4242
- name: golangci-lint
4343
uses: golangci/golangci-lint-action@v3
4444
with:
45-
version: v1.46.2
45+
version: latest

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [5.3.1] - 2023-08-16
10+
### Fixed
11+
- Wrap recursively wrapping the Chain itself instead of only adding another Link.
12+
913
## [5.3.0] - 2023-04-14
1014
### Fixed
1115
- Added Error interface for Link.
@@ -33,7 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3337
- Updated deps.
3438

3539

36-
[Unreleased]: https://github.com/go-playground/errors/compare/v5.3.0...HEAD
40+
[Unreleased]: https://github.com/go-playground/errors/compare/v5.3.1...HEAD
41+
[5.3.1]: https://github.com/go-playground/errors/compare/v5.3.0...v5.3.1
3742
[5.3.0]: https://github.com/go-playground/errors/compare/v5.2.3...v5.3.0
3843
[5.2.3]: https://github.com/go-playground/errors/compare/v5.2.2...v5.2.3
3944
[5.2.2]: https://github.com/go-playground/errors/compare/v5.2.1...v5.2.2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package errors
22
============
3-
![Project status](https://img.shields.io/badge/version-5.3.0-green.svg)
3+
![Project status](https://img.shields.io/badge/version-5.3.1-green.svg)
44
[![Build Status](https://travis-ci.org/go-playground/errors.svg?branch=master)](https://travis-ci.org/go-playground/errors)
55
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/errors)](https://goreportcard.com/report/github.com/go-playground/errors)
66
[![GoDoc](https://godoc.org/github.com/go-playground/errors?status.svg)](https://pkg.go.dev/github.com/go-playground/errors/v5)

chain.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,11 @@ func (l *Link) formatError(b []byte) []byte {
107107

108108
if l.Prefix != "" {
109109
b = append(b, l.Prefix...)
110-
}
111110

112-
if _, ok := l.Err.(Chain); !ok {
113-
if l.Prefix != "" {
111+
if l.Err != nil {
114112
b = append(b, ": "...)
113+
b = append(b, l.Err.Error()...)
115114
}
116-
b = append(b, l.Err.Error()...)
117115
}
118116

119117
for _, tag := range l.Tags {

errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func wrap(err error, prefix string, skipFrames int) (c Chain) {
7272
}
7373
var ok bool
7474
if c, ok = err.(Chain); ok {
75-
c = append(c, newLink(err, prefix, skipFrames))
75+
c = append(c, newLink(nil, prefix, skipFrames))
7676
} else {
7777
c = Chain{newLink(err, prefix, skipFrames)}
7878
for _, h := range helpers {

0 commit comments

Comments
 (0)