Skip to content

Commit 4a81f3a

Browse files
committed
Remove pkg/errors
1 parent 4c23296 commit 4a81f3a

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ go 1.21
55
require (
66
github.com/denisenkom/go-mssqldb v0.12.3
77
github.com/google/uuid v1.6.0
8-
github.com/pkg/errors v0.9.1
98
github.com/sirupsen/logrus v1.9.3
109
github.com/stretchr/testify v1.9.0
1110
golang.org/x/net v0.30.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1616
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1717
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
1818
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
19-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
20-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
2119
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2220
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2321
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=

querysql/testhelper/helper.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package testhelper
22

33
import (
4+
"errors"
45
"fmt"
56
"math"
67
"math/bits"
78
"runtime"
89
"strconv"
910
"strings"
10-
11-
"github.com/pkg/errors"
1211
)
1312

1413
var TestFunctionsCalled = map[string]bool{
@@ -68,22 +67,22 @@ func Parse(value string) (Money, error) {
6867

6968
parts := strings.Split(value, ".")
7069
if len(parts) != 2 || (len(parts[1]) != 2 && len(parts[1]) != 4) {
71-
return Money{}, errors.Errorf("not valid money: %s, must have 2 or 4 decimals", value)
70+
return Money{}, fmt.Errorf("not valid money: %s, must have 2 or 4 decimals", value)
7271
}
7372

7473
if len(parts[0]) > 1 && parts[0][0] == '0' {
75-
return Money{}, errors.Errorf("not valid money: %s, cannot have leading zeros", value)
74+
return Money{}, fmt.Errorf("not valid money: %s, cannot have leading zeros", value)
7675
}
7776

7877
// Note the 63 bit here. We are converting to int64 later on, which means that 63 is all
7978
// we are going to be able to report.
8079
whole, err := strconv.ParseUint(parts[0], 10, 63)
8180
if err != nil {
82-
return Money{}, errors.Errorf("not valid money: %s (parts[0]=%s)", value, parts[0])
81+
return Money{}, fmt.Errorf("not valid money: %s (parts[0]=%s)", value, parts[0])
8382
}
8483
fraccent, err := strconv.ParseUint(parts[1], 10, 16)
8584
if err != nil {
86-
return Money{}, errors.Errorf("not valid money: %s (parts[1]=%s)", value, parts[1])
85+
return Money{}, fmt.Errorf("not valid money: %s (parts[1]=%s)", value, parts[1])
8786
}
8887

8988
// This will never overflow, since the max we parse in fraccent is 16 bit, and we
@@ -97,12 +96,12 @@ func Parse(value string) (Money, error) {
9796

9897
hi, lo := bits.Mul64(whole, 10000)
9998
if hi != 0 {
100-
return Money{}, errors.Errorf("The amount %s would overflow an uint64 if converted to cents", value)
99+
return Money{}, fmt.Errorf("The amount %s would overflow an uint64 if converted to cents", value)
101100
}
102101

103102
cc, carry := bits.Add64(lo, fraccent, 0)
104103
if carry != 0 {
105-
return Money{}, errors.Errorf("The amount %s would overflow an uint64 if converted to cents", value)
104+
return Money{}, fmt.Errorf("The amount %s would overflow an uint64 if converted to cents", value)
106105
}
107106

108107
if sign == 1 {
@@ -128,11 +127,11 @@ func (target *Money) Scan(value interface{}) error {
128127
case string:
129128
strvalue = s
130129
default:
131-
return errors.Errorf("not valid money: %v", value)
130+
return fmt.Errorf("not valid money: %v", value)
132131
}
133132
parsed, err := Parse(strvalue)
134133
if err != nil {
135-
return errors.WithStack(err)
134+
return err
136135
}
137136
*target = parsed
138137
return nil

0 commit comments

Comments
 (0)