Skip to content

Commit

Permalink
Remove unnecessary Unwrap implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
yukia3e committed Apr 27, 2022
1 parent 9e54ebd commit 464537e
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/jinzhu/inflection v1.0.0
github.com/kenshaw/snaker v0.1.6
github.com/spf13/cobra v1.2.1
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/tools v0.1.8
google.golang.org/api v0.61.0
google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ golang.org/x/sys v0.0.0-20211205182925-97ca703d548d h1:FjkYO/PPp4Wi0EAUOVLxePm7q
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f h1:8w7RhxzTVgUzw/AH/9mUV5q0vMgy40SQRursCcfmkCw=
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc=
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 1 addition & 1 deletion templates/yo_db.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (e yoError) DBTableName() string {
func (e yoError) GRPCStatus() *status.Status {
var ae *apierror.APIError
if errors.As(e.err, &ae) {
return status.Convert(ae.Unwrap())
return status.Convert(ae)
}

return status.New(e.code, e.Error())
Expand Down
2 changes: 1 addition & 1 deletion test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func TestSessionNotFound(t *testing.T) {
t.Fatalf("the error returned by yo can be apierror.APIError: %T", err)
}

st := status.Convert(ae.Unwrap())
st := status.Convert(ae)
ri := extractResourceInfo(st)

expectedResourceInfo := &errdetails.ResourceInfo{
Expand Down
2 changes: 1 addition & 1 deletion test/testmodels/customtypes/yo_db.yo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/testmodels/default/yo_db.yo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/testmodels/single/single_file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions tplbin/templates.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion v2/module/builtin/templates/yo_db.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (e yoError) DBTableName() string {
func (e yoError) GRPCStatus() *status.Status {
var ae *apierror.APIError
if errors.As(e.err, &ae) {
return status.Convert(ae.Unwrap())
return status.Convert(ae)
}

return status.New(e.code, e.Error())
Expand Down
2 changes: 1 addition & 1 deletion v2/test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ func TestSessionNotFound(t *testing.T) {
t.Fatalf("the error returned by yo can be apierror.APIError: %T", err)
}

st := status.Convert(ae.Unwrap())
st := status.Convert(ae)
ri := extractResourceInfo(st)

expectedResourceInfo := &errdetails.ResourceInfo{
Expand Down
2 changes: 1 addition & 1 deletion v2/test/testmodels/default/yo_db.yo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion v2/test/testmodels/legacy_default/yo_db.yo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 464537e

Please sign in to comment.