Skip to content

Commit 1d45bd3

Browse files
authored
Merge pull request #22 from saschagrunert/errors
Switch to golang native error wrapping
2 parents b7e5ce8 + c4255d0 commit 1d45bd3

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

cmd/audit.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"io/ioutil"
2223
"net/http"
@@ -29,8 +30,6 @@ import (
2930
"sync"
3031
"time"
3132

32-
"github.com/pkg/errors"
33-
3433
"github.com/spf13/cobra"
3534
"k8s.io/apimachinery/pkg/util/sets"
3635

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module github.com/kubernetes-sigs/maintainers
33
go 1.18
44

55
require (
6-
github.com/pkg/errors v0.9.1
76
github.com/spf13/cobra v1.3.0
87
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
98
k8s.io/apimachinery v0.22.3

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T
314314
github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
315315
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
316316
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
317-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
318317
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
319318
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
320319
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

pkg/utils/devstats_utils.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import (
2323
"io/ioutil"
2424
"net/http"
2525
"strings"
26-
27-
"github.com/pkg/errors"
2826
)
2927

3028
func GetContributionsForAYear(repository string, period string) ([]Contribution, error) {
@@ -53,7 +51,7 @@ func GetContributionsForAYear(repository string, period string) ([]Contribution,
5351
defer resp.Body.Close()
5452

5553
if resp.StatusCode != http.StatusOK {
56-
return nil, errors.Wrap(err, fmt.Sprintf("bad error code from devstats: %d", resp.StatusCode))
54+
return nil, fmt.Errorf("bad error code from devstats: %d: %w", resp.StatusCode, err)
5755
}
5856

5957
var parsed map[string]map[string]map[string][]Frames
@@ -63,7 +61,7 @@ func GetContributionsForAYear(repository string, period string) ([]Contribution,
6361
}
6462
err = json.Unmarshal(body, &parsed)
6563
if err != nil {
66-
return nil, errors.Wrap(err, "unable to parse json from devstats")
64+
return nil, fmt.Errorf("unable to parse json from devstats: %w", err)
6765
}
6866

6967
foo := parsed["results"]["A"]["frames"][0].Data.Items[0]

0 commit comments

Comments
 (0)