Skip to content

Commit

Permalink
dep: go mod: remove direct dep github.com/pkg/errors
Browse files Browse the repository at this point in the history
  • Loading branch information
grokify committed Feb 10, 2022
1 parent 6f9d611 commit d2aad3d
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 27 deletions.
8 changes: 4 additions & 4 deletions codegen/specs-engagevoice_v3.0.0/convert/java_to_oas3.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ import (
"strings"

oas3 "github.com/getkin/kin-openapi/openapi3"
"github.com/grokify/mogo/errors/errorsutil"
"github.com/grokify/mogo/fmt/fmtutil"
"github.com/grokify/mogo/io/ioutilmore"
"github.com/grokify/mogo/type/stringsutil"
"github.com/grokify/spectrum/openapi3"
"github.com/grokify/spectrum/openapi3/springopenapi3"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
)

func ReadOas3Spec(file string, validate bool) (*openapi3.Spec, error) {
bytes, err := ioutil.ReadFile(file)
if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("Filename [%v]", file))
return nil, errorsutil.Wrap(err, fmt.Sprintf("Filename [%v]", file))
}
swag := &openapi3.Spec{}
err = swag.UnmarshalJSON(bytes)
if err != nil {
return nil, errors.Wrap(err, fmt.Sprintf("Filename [%v]", file))
return nil, errorsutil.Wrap(err, fmt.Sprintf("Filename [%v]", file))
}
if validate {
err = swag.Validate(context.Background())
return swag, errors.Wrap(err, fmt.Sprintf("Filename [%v]", file))
return swag, errorsutil.Wrap(err, fmt.Sprintf("Filename [%v]", file))
}
return swag, nil
}
Expand Down
4 changes: 2 additions & 2 deletions engagedigital/v1/examples/role_create_update/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"time"

"github.com/antihax/optional"
"github.com/grokify/mogo/errors/errorsutil"
"github.com/grokify/mogo/fmt/fmtutil"
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"

engagedigital "github.com/grokify/go-ringcentral-client/engagedigital/v1/client"
utils "github.com/grokify/go-ringcentral-client/engagedigital/v1/util"
Expand All @@ -24,7 +24,7 @@ type options struct {
func GetRole(client *engagedigital.APIClient, roleName string) (engagedigital.Role, error) {
info, resp, err := client.RolesApi.GetAllRoles(context.Background(), nil)
if err != nil {
err = errors.Wrap(err, "E_GET_ALL_ROLES")
err = errorsutil.Wrap(err, "E_GET_ALL_ROLES")
return engagedigital.Role{}, err
} else if resp.StatusCode != 200 {
return engagedigital.Role{}, fmt.Errorf("E_STATUS_CODE [%v]", resp.StatusCode)
Expand Down
6 changes: 3 additions & 3 deletions engagedigital/v1/examples/source_update/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"log"

"github.com/antihax/optional"
"github.com/grokify/mogo/errors/errorsutil"
"github.com/grokify/mogo/fmt/fmtutil"
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"

engagedigital "github.com/grokify/go-ringcentral-client/engagedigital/v1/client"
utils "github.com/grokify/go-ringcentral-client/engagedigital/v1/util"
Expand All @@ -30,7 +30,7 @@ func main() {

info, resp, err := client.SourcesApi.GetAllSources(context.Background(), nil)
if err != nil {
err = errors.Wrap(err, "E_GET_ALL_SOURCES")
err = errorsutil.Wrap(err, "E_GET_ALL_SOURCES")
log.Fatal(err)
} else if resp.StatusCode != 200 {
log.Fatal(resp.StatusCode)
Expand All @@ -50,7 +50,7 @@ func main() {
info, resp, err := client.SourcesApi.UpdateSource(
context.Background(), source.Id, opts)
if err != nil {
err = errors.Wrap(err, "E_UPDATE_SOURCE")
err = errorsutil.Wrap(err, "E_UPDATE_SOURCE")
log.Fatal(err)
} else if resp.StatusCode != 200 {
log.Fatal(resp.StatusCode)
Expand Down
4 changes: 2 additions & 2 deletions engagedigital/v1/examples/user_create_update_invite/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"log"

"github.com/antihax/optional"
"github.com/grokify/mogo/errors/errorsutil"
"github.com/grokify/mogo/fmt/fmtutil"
"github.com/grokify/mogo/net/smtputil"
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"

engagedigital "github.com/grokify/go-ringcentral-client/engagedigital/v1/client"
utils "github.com/grokify/go-ringcentral-client/engagedigital/v1/util"
Expand All @@ -24,7 +24,7 @@ type options struct {
func GetRole(client *engagedigital.APIClient, roleName string) (engagedigital.Role, error) {
info, resp, err := client.RolesApi.GetAllRoles(context.Background(), nil)
if err != nil {
err = errors.Wrap(err, "E_GET_ALL_ROLES")
err = errorsutil.Wrap(err, "E_GET_ALL_ROLES")
return engagedigital.Role{}, err
} else if resp.StatusCode != 200 {
return engagedigital.Role{}, fmt.Errorf("E_STATUS_CODE [%v]", resp.StatusCode)
Expand Down
5 changes: 3 additions & 2 deletions engagevoice/v1/util/lite/api_token.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package lite

import (
"errors"
"fmt"
"io/ioutil"
"log"
Expand All @@ -10,8 +11,8 @@ import (
"time"

"github.com/grokify/mogo/encoding/jsonutil"
"github.com/grokify/mogo/errors/errorsutil"
"github.com/grokify/mogo/net/httputilmore"
"github.com/pkg/errors"
)

// portal.vacd.biz:8081
Expand Down Expand Up @@ -116,7 +117,7 @@ func ExchangeAPIToken(authToken string) (string, error) {
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return "", errors.Wrap(err, "ExchangeAPIToken.client.Do()")
return "", errorsutil.Wrap(err, "ExchangeAPIToken.client.Do()")
} else if resp.StatusCode != 200 {
return "", fmt.Errorf("TOKEN_RESP_STATUS_CODE_NOT_200 [%v]", resp.StatusCode)
}
Expand Down
2 changes: 1 addition & 1 deletion engagevoice/v1/util/lite/client.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package lite

import (
"errors"
"net/http"
"strings"

"github.com/grokify/mogo/net/httputilmore"
"github.com/grokify/mogo/net/urlutil"
"github.com/pkg/errors"
)

type ClientLite struct {
Expand Down
10 changes: 5 additions & 5 deletions engagevoice/v1/util/lite/ringcentral_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/grokify/goauth"
"github.com/grokify/goauth/credentials"
"github.com/grokify/mogo/encoding/jsonutil"
"github.com/pkg/errors"
"github.com/grokify/mogo/errors/errorsutil"
)

type EngageCredentials struct {
Expand All @@ -20,7 +20,7 @@ func NewEngageCredentialsJSON(rcCredentialsJSON []byte) (EngageCredentials, erro
ec := EngageCredentials{}
rcCredentials, err := credentials.NewCredentialsJSON(rcCredentialsJSON, nil)
if err != nil {
return ec, errors.Wrap(err, "NewEngageCredentialsJSON>>ringcentral.NewCredentialsJSON")
return ec, errorsutil.Wrap(err, "NewEngageCredentialsJSON>>ringcentral.NewCredentialsJSON")
}
ec.Credentials = rcCredentials
return ec, nil
Expand All @@ -29,7 +29,7 @@ func NewEngageCredentialsJSON(rcCredentialsJSON []byte) (EngageCredentials, erro
func (ec *EngageCredentials) LoadNewTokens() error {
rcToken, err := ec.Credentials.NewToken()
if err != nil {
return errors.Wrap(err, "EngageCredentials>>ec.Credentials.NewToken()")
return errorsutil.Wrap(err, "EngageCredentials>>ec.Credentials.NewToken()")
}
evToken, err := RcToEvToken(rcToken.AccessToken)
if err != nil {
Expand Down Expand Up @@ -61,15 +61,15 @@ func RcToEvToken(rctoken string) (EngageToken, error) {
"https://engage.ringcentral.com/api/auth/login/rc/accesstoken",
url.Values{"rcAccessToken": {rctoken}, "rcTokenType": {"Bearer"}})
if err != nil {
return evToken, errors.Wrap(err, "RcToEvToken.PostForm")
return evToken, errorsutil.Wrap(err, "RcToEvToken.PostForm")
}
if res.StatusCode >= 300 {
return evToken, fmt.Errorf("RcToEvToken.ApiResponse.StatusCode [%v]", res.StatusCode)
}

_, err = jsonutil.UnmarshalReader(res.Body, &evToken)
if err != nil {
err = errors.Wrap(err, "RcToEvToken.jsonutil.UnmarshalIoReader")
err = errorsutil.Wrap(err, "RcToEvToken.jsonutil.UnmarshalIoReader")
}
return evToken, err
}
3 changes: 1 addition & 2 deletions engagevoice/v1/util/lite/user.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package lite

import (
"errors"
"io/ioutil"
"net/http"

"github.com/pkg/errors"
)

func GetUsers(serverURL, authOrApiToken string) ([]byte, error) {
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/jessevdk/go-flags v1.5.0
github.com/joho/godotenv v1.4.0
github.com/nyaruka/phonenumbers v1.0.74
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.26.1
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
)
6 changes: 3 additions & 3 deletions office/v1/examples/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
"github.com/grokify/goauth/credentials"
"github.com/grokify/goauth/ringcentral"
"github.com/grokify/mogo/config"
"github.com/grokify/mogo/errors/errorsutil"
"github.com/grokify/mogo/fmt/fmtutil"
"github.com/grokify/mogo/mime/multipartutil"
"github.com/grokify/mogo/net/httputilmore"
"github.com/grokify/mogo/net/urlutil"
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"
"golang.org/x/oauth2"
)

Expand All @@ -36,7 +36,7 @@ func loadEnv() (Options, error) {

err = config.LoadDotEnvSkipEmpty(opts.EnvPath, os.Getenv("ENV_PATH"), "./.env")
if err != nil {
return opts, errors.Wrap(err, "E_LOAD_DOT_ENV")
return opts, errorsutil.Wrap(err, "E_LOAD_DOT_ENV")
}
return opts, nil
}
Expand All @@ -45,7 +45,7 @@ func getApplicationConfig(cfg []byte) (credentials.Credentials, error) {
ac := credentials.Credentials{}
err := json.Unmarshal(cfg, &ac)
if err != nil {
return ac, errors.Wrap(
return ac, errorsutil.Wrap(
err, fmt.Sprintf("E_JSON_UNMARSHAL [%v]", string(cfg)))
}
return ac, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"os"

"github.com/grokify/mogo/config"
"github.com/grokify/mogo/errors/errorsutil"
"github.com/grokify/mogo/fmt/fmtutil"
"github.com/grokify/mogo/net/httputilmore"
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"

ru "github.com/grokify/go-ringcentral-client/office/v1/util"
ro "github.com/grokify/goauth/ringcentral"
Expand All @@ -34,7 +34,7 @@ func main() {

httpClient, err := ro.NewHttpClientEnvFlexStatic("")
if err != nil {
log.Fatal(errors.Wrap(err, "getHttpClientEnv"))
log.Fatal(errorsutil.Wrap(err, "getHttpClientEnv"))
}
serverURL := os.Getenv("RINGCENTRAL_SERVER_URL")
apiClient, err := ru.NewApiClientHttpClientBaseURL(httpClient, serverURL)
Expand Down

0 comments on commit d2aad3d

Please sign in to comment.