Skip to content

Commit

Permalink
fix chaining recursive issue (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
deankarn authored Aug 16, 2023
1 parent 0ca5836 commit 81fde8d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.18.x]
go-version: [1.18.x, 1.21.0]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -37,9 +37,9 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.21.x
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.46.2
version: latest
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.3.1] - 2023-08-16
### Fixed
- Wrap recursively wrapping the Chain itself instead of only adding another Link.

## [5.3.0] - 2023-04-14
### Fixed
- Added Error interface for Link.
Expand Down Expand Up @@ -33,7 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated deps.


[Unreleased]: https://github.com/go-playground/errors/compare/v5.3.0...HEAD
[Unreleased]: https://github.com/go-playground/errors/compare/v5.3.1...HEAD
[5.3.1]: https://github.com/go-playground/errors/compare/v5.3.0...v5.3.1
[5.3.0]: https://github.com/go-playground/errors/compare/v5.2.3...v5.3.0
[5.2.3]: https://github.com/go-playground/errors/compare/v5.2.2...v5.2.3
[5.2.2]: https://github.com/go-playground/errors/compare/v5.2.1...v5.2.2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package errors
============
![Project status](https://img.shields.io/badge/version-5.3.0-green.svg)
![Project status](https://img.shields.io/badge/version-5.3.1-green.svg)
[![Build Status](https://travis-ci.org/go-playground/errors.svg?branch=master)](https://travis-ci.org/go-playground/errors)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/errors)](https://goreportcard.com/report/github.com/go-playground/errors)
[![GoDoc](https://godoc.org/github.com/go-playground/errors?status.svg)](https://pkg.go.dev/github.com/go-playground/errors/v5)
Expand Down
6 changes: 2 additions & 4 deletions chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,11 @@ func (l *Link) formatError(b []byte) []byte {

if l.Prefix != "" {
b = append(b, l.Prefix...)
}

if _, ok := l.Err.(Chain); !ok {
if l.Prefix != "" {
if l.Err != nil {
b = append(b, ": "...)
b = append(b, l.Err.Error()...)
}
b = append(b, l.Err.Error()...)
}

for _, tag := range l.Tags {
Expand Down
2 changes: 1 addition & 1 deletion errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func wrap(err error, prefix string, skipFrames int) (c Chain) {
}
var ok bool
if c, ok = err.(Chain); ok {
c = append(c, newLink(err, prefix, skipFrames))
c = append(c, newLink(nil, prefix, skipFrames))
} else {
c = Chain{newLink(err, prefix, skipFrames)}
for _, h := range helpers {
Expand Down

0 comments on commit 81fde8d

Please sign in to comment.