Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: drop dependency on github.com/pkg/errors #301

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions domain/service_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package domain

import (
"encoding/json"
"fmt"
"reflect"

"github.com/pkg/errors"
)

type ServiceMetadata struct {
Expand All @@ -23,7 +22,7 @@ func (sm ServiceMetadata) MarshalJSON() ([]byte, error) {

b, err := json.Marshal(Alias(sm))
if err != nil {
return []byte{}, errors.Wrap(err, "unmarshallable content in AdditionalMetadata")
return nil, fmt.Errorf("unmarshallable content in AdditionalMetadata: %w", err)
}

var m map[string]interface{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error returned by json.Unmarshal operation in line 29 is not being checked. It's a good practice in Go to always check for errors. I know it is out of the scope of the PR, but you may want to add the logic

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zucchinidev. I'll handle this in #303

Expand Down
5 changes: 2 additions & 3 deletions domain/service_plan_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package domain

import (
"encoding/json"
"fmt"
"reflect"
"strings"

"github.com/pkg/errors"
)

type ServicePlanMetadata struct {
Expand Down Expand Up @@ -51,7 +50,7 @@ func (spm ServicePlanMetadata) MarshalJSON() ([]byte, error) {

b, err := json.Marshal(Alias(spm))
if err != nil {
return []byte{}, errors.Wrap(err, "unmarshallable content in AdditionalMetadata")
return nil, fmt.Errorf("unmarshallable content in AdditionalMetadata: %w", err)
}

var m map[string]interface{}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.32.0
github.com/pborman/uuid v1.2.1
github.com/pkg/errors v0.9.1
honnef.co/go/tools v0.4.7
)

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk=
github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg=
github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw=
github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
Expand Down
3 changes: 1 addition & 2 deletions handlers/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package handlers_test

import (
"context"
"errors"
"log/slog"
"net/http"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/pkg/errors"

"github.com/pivotal-cf/brokerapi/v11/domain"
"github.com/pivotal-cf/brokerapi/v11/domain/apiresponses"
brokerFakes "github.com/pivotal-cf/brokerapi/v11/fakes"
Expand Down
2 changes: 1 addition & 1 deletion handlers/last_binding_operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package handlers_test
import (
"context"
"encoding/json"
"errors"
"fmt"
"log/slog"
"net/http"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/pivotal-cf/brokerapi/v11/handlers"
"github.com/pivotal-cf/brokerapi/v11/handlers/fakes"
"github.com/pivotal-cf/brokerapi/v11/middlewares"
"github.com/pkg/errors"
)

var _ = Describe("LastBindingOperation", func() {
Expand Down
Loading