Skip to content

Commit 70b40c8

Browse files
committed
Update Go to 1.25, improve coverage setup and error handling
1 parent f0f0807 commit 70b40c8

7 files changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
go:
14-
- '1.24'
14+
- '1.25'
1515

1616
steps:
1717
- name: Checkout
@@ -41,3 +41,9 @@ jobs:
4141

4242
- name: Test
4343
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
44+
45+
- name: Upload coverage
46+
uses: coverallsapp/github-action@v2
47+
with:
48+
path-to-lcov: coverage.out
49+
parallel: false

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Latest Stable Version][ico-release]][link-release]
44
[![Build Status][ico-workflow]][link-workflow]
55
[![Coverage Status][ico-coverage]][link-coverage]
6-
[![Quality Score][ico-code-quality]][link-code-quality]
76
[![Go Report Card][ico-go-report-card]][link-go-report-card]
87
[![Go Dev Reference][ico-go-dev-reference]][link-go-dev-reference]
98
[![Software License][ico-license]][link-licence]
@@ -82,8 +81,7 @@ The MIT License (MIT). Please see [License File][link-licence] for more informat
8281
[ico-release]: https://img.shields.io/github/v/release/gravitton/errors?style=flat-square&colorB=blue
8382
[ico-go-dev-reference]: https://img.shields.io/badge/go.dev-reference-blue?style=flat-square
8483
[ico-go-report-card]: https://goreportcard.com/badge/github.com/gravitton/errors?style=flat-square
85-
[ico-coverage]: https://img.shields.io/scrutinizer/coverage/g/gravitton/errors/main.svg?style=flat-square
86-
[ico-code-quality]: https://img.shields.io/scrutinizer/g/gravitton/errors.svg?style=flat-square
84+
[ico-coverage]: https://img.shields.io/coverallsCoverage/github/gravitton/errors?style=flat-square
8785

8886
[link-author]: https://github.com/gravitton
8987
[link-release]: https://github.com/gravitton/errors/releases
@@ -93,5 +91,4 @@ The MIT License (MIT). Please see [License File][link-licence] for more informat
9391
[link-workflow]: https://github.com/gravitton/errors/actions
9492
[link-go-dev-reference]: https://pkg.go.dev/github.com/gravitton/errors
9593
[link-go-report-card]: https://goreportcard.com/report/github.com/gravitton/errors
96-
[link-coverage]: https://scrutinizer-ci.com/g/gravitton/errors/code-structure
97-
[link-code-quality]: https://scrutinizer-ci.com/g/gravitton/errors
94+
[link-coverage]: https://coveralls.io/github/gravitton/errors

error.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ func (e *DataError) Error() string {
4848
return e.err.Error()
4949
}
5050

51+
func (e *DataError) GoString() string {
52+
return fmt.Sprintf("%#v %#v", e.err, e.cause)
53+
}
54+
5155
func (e *DataError) Fields() map[string]any {
5256
return e.data
5357
}

error_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package errors
22

33
import (
44
"errors"
5+
"fmt"
56
"github.com/gravitton/assert"
67
"reflect"
78
"testing"
@@ -26,6 +27,8 @@ func TestFields(t *testing.T) {
2627
err2 := err.WithFields(map[string]any{"type": "warning"})
2728
assert.NotSame(t, err1, err2)
2829
assert.NotContains(t, err.Fields(), "type")
30+
assert.Equal(t, err.Error(), "test3")
31+
assert.Equal(t, fmt.Sprintf("%#v", err), "test3")
2932
assert.Equal(t, err2.Fields()["type"], "warning")
3033

3134
err3 := err.WithField("action", "send")

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/gravitton/errors
22

3-
go 1.24
3+
go 1.25
44

5-
require github.com/gravitton/assert v0.2.0
5+
require github.com/gravitton/assert v0.5.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github.com/gravitton/assert v0.2.0 h1:zJL3v5rHP/P1eJKljxFTb8zbW8WWr7Ih5wZBT/JMp80=
2-
github.com/gravitton/assert v0.2.0/go.mod h1:t/H52Szce7uofC0H1sN9yLZsj1TBvky5sGmrFiaxypY=
1+
github.com/gravitton/assert v0.5.0 h1:7HW4+nagmtDEI7ZMBjeZo/sBJTNnxtWGoVw/Vxe1VUU=
2+
github.com/gravitton/assert v0.5.0/go.mod h1:wQGHJvwsxQQ7qdX++NLofrI2cJvYIdJJtAo7A15qcAY=

multi_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestMultiErrors(t *testing.T) {
1717
assert.Length(t, errs.Unwrap(), 1)
1818
assert.Equal(t, errs.Unwrap(), []error{err1})
1919
assert.Equal(t, errs.Error(), "dummy1")
20-
assert.Same(t, errs.Unwrap()[0], err1)
20+
assert.Same[error](t, errs.Unwrap()[0], err1)
2121
assert.ErrorIs(t, errs, err1)
2222

2323
err2 := New("dummy2")

0 commit comments

Comments
 (0)