Skip to content

Commit 76ee3f3

Browse files
committed
dep: go mod: update
1 parent b8d5867 commit 76ee3f3

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed

cmd/oas3lint/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log"
66
"regexp"
77

8+
"github.com/grokify/mogo/errors/errorsutil"
89
"github.com/grokify/mogo/fmt/fmtutil"
910
"github.com/grokify/mogo/log/severity"
1011
"github.com/grokify/mogo/os/osutil"
@@ -14,7 +15,6 @@ import (
1415
"github.com/grokify/spectrum/openapi3lint/extensions"
1516
"github.com/grokify/spectrum/openapi3lint/lintutil"
1617
"github.com/jessevdk/go-flags"
17-
"github.com/pkg/errors"
1818
)
1919

2020
type Options struct {
@@ -59,7 +59,7 @@ func main() {
5959

6060
pol, err := polCfg.Policy()
6161
if err != nil {
62-
log.Fatal(errors.Wrap(err, "polCfg.Policy()"))
62+
log.Fatal(errorsutil.Wrap(err, "polCfg.Policy()"))
6363
}
6464
fmtutil.PrintJSON(pol)
6565
fmtutil.PrintJSON(pol.RuleNames())

openapi2/merge.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
"regexp"
88
"strings"
99

10+
"github.com/grokify/mogo/errors/errorsutil"
1011
"github.com/grokify/mogo/io/ioutilmore"
1112
"github.com/grokify/mogo/os/osutil"
12-
"github.com/pkg/errors"
1313
)
1414

1515
var jsonFileRx = regexp.MustCompile(`(?i)\.json\s*$`)
@@ -45,7 +45,7 @@ func MergeFilepaths(filepaths []string) (Specification, error) {
4545
fmt.Printf("[%v][%v]\n", i, fpath)
4646
thisSpec, err := ReadOpenAPI2SpecFileDirect(fpath)
4747
if err != nil {
48-
return specMaster, errors.Wrap(err, fmt.Sprintf("E_READ_SPEC [%v]", fpath))
48+
return specMaster, errorsutil.Wrap(err, fmt.Sprintf("E_READ_SPEC [%v]", fpath))
4949
}
5050
if i == 0 {
5151
specMaster = thisSpec
@@ -96,12 +96,12 @@ func MergeDefinitions(specMaster, specExtra Specification) Specification {
9696
func WriteFileDirMerge(outfile, inputDir string, perm os.FileMode) error {
9797
spec, err := MergeDirectory(inputDir)
9898
if err != nil {
99-
return errors.Wrap(err, "E_OPENAPI3_MERGE_DIRECTORY_FAILED")
99+
return errorsutil.Wrap(err, "E_OPENAPI3_MERGE_DIRECTORY_FAILED")
100100
}
101101

102102
err = ioutilmore.WriteFileJSON(outfile, spec, perm, "", " ")
103103
if err != nil {
104-
return errors.Wrap(err, "E_OPENAPI3_WRITE_FAILED")
104+
return errorsutil.Wrap(err, "E_OPENAPI3_WRITE_FAILED")
105105
}
106106
return nil
107107
}

openapi3/merge.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111

1212
oas3 "github.com/getkin/kin-openapi/openapi3"
1313
"github.com/grokify/gocharts/data/table"
14+
"github.com/grokify/mogo/errors/errorsutil"
1415
"github.com/grokify/mogo/os/osutil"
15-
"github.com/pkg/errors"
1616
)
1717

1818
var jsonFileRx = regexp.MustCompile(`(?i)\.(json|yaml|yml)\s*$`)
@@ -52,14 +52,14 @@ func MergeFiles(filepaths []string, mergeOpts *MergeOptions) (*Spec, error) {
5252
for i, fpath := range filepaths {
5353
thisSpec, err := ReadFile(fpath, validateEach)
5454
if err != nil {
55-
return specMaster, errors.Wrap(err, fmt.Sprintf("ReadSpecError [%v] ValidateEach [%v]", fpath, validateEach))
55+
return specMaster, errorsutil.Wrap(err, fmt.Sprintf("ReadSpecError [%v] ValidateEach [%v]", fpath, validateEach))
5656
}
5757
if i == 0 {
5858
specMaster = thisSpec
5959
} else {
6060
specMaster, err = Merge(specMaster, thisSpec, fpath, mergeOpts)
6161
if err != nil {
62-
return nil, errors.Wrap(err, fmt.Sprintf("Merging [%v]", fpath))
62+
return nil, errorsutil.Wrap(err, fmt.Sprintf("Merging [%v]", fpath))
6363
}
6464
}
6565
}
@@ -71,7 +71,7 @@ func MergeFiles(filepaths []string, mergeOpts *MergeOptions) (*Spec, error) {
7171
}
7272
newSpec, err := oas3.NewLoader().LoadFromData(bytes)
7373
if err != nil {
74-
return newSpec, errors.Wrap(err, "Loader.LoadSwaggerFromData (MergeFiles().ValidateFinal)")
74+
return newSpec, errorsutil.Wrap(err, "Loader.LoadSwaggerFromData (MergeFiles().ValidateFinal)")
7575
}
7676
return newSpec, nil
7777
}
@@ -339,17 +339,17 @@ func MergeRequestBodies(specMaster, specExtra *Spec, specExtraNote string) (*Spe
339339
func WriteFileDirMerge(outfile, inputDir string, perm os.FileMode, mergeOpts *MergeOptions) (int, error) {
340340
spec, num, err := MergeDirectory(inputDir, mergeOpts)
341341
if err != nil {
342-
return num, errors.Wrap(err, "E_OPENAPI3_MERGE_DIRECTORY_FAILED")
342+
return num, errorsutil.Wrap(err, "E_OPENAPI3_MERGE_DIRECTORY_FAILED")
343343
}
344344

345345
bytes, err := spec.MarshalJSON()
346346
if err != nil {
347-
return num, errors.Wrap(err, "E_SWAGGER2_JSON_ENCODING_FAILED")
347+
return num, errorsutil.Wrap(err, "E_SWAGGER2_JSON_ENCODING_FAILED")
348348
}
349349

350350
err = ioutil.WriteFile(outfile, bytes, perm)
351351
if err != nil {
352-
return num, errors.Wrap(err, "E_SWAGGER2_WRITE_FAILED")
352+
return num, errorsutil.Wrap(err, "E_SWAGGER2_WRITE_FAILED")
353353
}
354354
return num, nil
355355
}

openapi3/openapi3postman2/convert.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import (
1010
"strings"
1111

1212
oas3 "github.com/getkin/kin-openapi/openapi3"
13+
"github.com/grokify/mogo/errors/errorsutil"
1314
"github.com/grokify/mogo/net/urlutil"
1415
"github.com/grokify/spectrum/openapi3"
1516
"github.com/grokify/spectrum/postman2"
1617
"github.com/grokify/spectrum/postman2/simple"
17-
"github.com/pkg/errors"
1818
)
1919

2020
// Converter is the struct that manages the conversion.
@@ -33,7 +33,7 @@ func NewConverter(cfg Configuration) Converter {
3333
func (conv *Converter) MergeConvert(openapiFilepath string, pmanBaseFilepath string, pmanSpecFilepath string) error {
3434
oas3spec, err := openapi3.ReadFile(openapiFilepath, true)
3535
if err != nil {
36-
errors.Wrap(err,
36+
errorsutil.Wrap(err,
3737
fmt.Sprintf(
3838
"cannot read OpenAPI 3 spec [%s] openapi3postman2.Converter.MergeConvert << openapi3.ReadFile",
3939
openapiFilepath))
@@ -44,7 +44,7 @@ func (conv *Converter) MergeConvert(openapiFilepath string, pmanBaseFilepath str
4444
if len(pmanBaseFilepath) > 0 {
4545
pman, err := simple.ReadCanonicalCollection(pmanBaseFilepath)
4646
if err != nil {
47-
err = errors.Wrap(err,
47+
err = errorsutil.Wrap(err,
4848
fmt.Sprintf(
4949
"cannot read Postman Collection [%s] openapi3postman2.Converter.MergeConvert << simple.ReadCanonicalCollection",
5050
pmanBaseFilepath))

openapi3/read.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
oas3 "github.com/getkin/kin-openapi/openapi3"
1111
"github.com/ghodss/yaml"
1212
"github.com/grokify/mogo/encoding/jsonutil"
13-
"github.com/pkg/errors"
13+
"github.com/grokify/mogo/errors/errorsutil"
1414
)
1515

1616
var rxYamlExtension = regexp.MustCompile(`(?i)\.ya?ml\s*$`)
@@ -35,7 +35,7 @@ func ReadFile(oas3file string, validate bool) (*Spec, error) {
3535
}
3636
bytes, err := ioutil.ReadFile(oas3file)
3737
if err != nil {
38-
return nil, errors.Wrap(err, fmt.Sprintf("ReadFile.ReadFile.Error.Filename [%v]", oas3file))
38+
return nil, errorsutil.Wrap(err, fmt.Sprintf("ReadFile.ReadFile.Error.Filename [%v]", oas3file))
3939
}
4040
if rxYamlExtension.MatchString(oas3file) {
4141
bytes, err = yaml.YAMLToJSON(bytes)
@@ -46,7 +46,7 @@ func ReadFile(oas3file string, validate bool) (*Spec, error) {
4646
spec := &Spec{}
4747
err = spec.UnmarshalJSON(bytes)
4848
if err != nil {
49-
return nil, errors.Wrap(err, fmt.Sprintf("ReadFile.UnmarshalJSON.Error.Filename [%s]", oas3file))
49+
return nil, errorsutil.Wrap(err, fmt.Sprintf("ReadFile.UnmarshalJSON.Error.Filename [%s]", oas3file))
5050
}
5151
return spec, nil
5252
}
@@ -72,11 +72,11 @@ func Parse(oas3Bytes []byte) (*Spec, error) {
7272
func ReadAndValidateFile(oas3file string) (*Spec, error) {
7373
bytes, err := ioutil.ReadFile(oas3file)
7474
if err != nil {
75-
return nil, errors.Wrap(err, "E_READ_FILE_ERROR")
75+
return nil, errorsutil.Wrap(err, "E_READ_FILE_ERROR")
7676
}
7777
spec, err := oas3.NewLoader().LoadFromData(bytes)
7878
if err != nil {
79-
return spec, errors.Wrap(err, fmt.Sprintf("E_OPENAPI3_SPEC_LOAD_VALIDATE_ERROR [%s]", oas3file))
79+
return spec, errorsutil.Wrap(err, fmt.Sprintf("E_OPENAPI3_SPEC_LOAD_VALIDATE_ERROR [%s]", oas3file))
8080
}
8181
_, err = ValidateMore(spec)
8282
return spec, err

openapi3edit/multi.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"fmt"
55

66
oas3 "github.com/getkin/kin-openapi/openapi3"
7+
"github.com/grokify/mogo/errors/errorsutil"
78
"github.com/grokify/mogo/fmt/fmtutil"
89
"github.com/grokify/spectrum/openapi3"
9-
"github.com/pkg/errors"
1010
)
1111

1212
type SpecMoreModifyMultiOpts struct {
@@ -68,7 +68,7 @@ func SpecMoreModifyMulti(sm *openapi3.SpecMore, opts SpecMoreModifyMultiOpts) er
6868
if opts.PathsExec {
6969
err := SpecPathsModify(sm.Spec, opts.Paths)
7070
if err != nil {
71-
return errors.Wrap(err, "SpecModifyMulti")
71+
return errorsutil.Wrap(err, "SpecModifyMulti")
7272
}
7373
if opts.PathsShow {
7474
fmtutil.PrintJSON(InspectPaths(sm.Spec))

openapi3lint/policy_config.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"io/ioutil"
77
"time"
88

9+
"github.com/grokify/mogo/errors/errorsutil"
910
"github.com/grokify/mogo/type/stringsutil"
10-
"github.com/pkg/errors"
1111
)
1212

1313
type PolicyConfig struct {
@@ -104,14 +104,14 @@ func (cfg *PolicyConfig) Policy() (Policy, error) {
104104
ruleCollectionsMap[ruleName] = append(ruleCollectionsMap[ruleName], stdRules.Name())
105105
rule, err := stdRules.Rule(ruleName)
106106
if err != nil {
107-
return pol, errors.Wrap(err, "standard error not found. PolicyConfig.Policy()")
107+
return pol, errorsutil.Wrap(err, "standard error not found. PolicyConfig.Policy()")
108108
}
109109
if err = pol.AddRule(rule, ruleCfg.Severity, true); err != nil {
110-
return pol, errors.Wrap(err, fmt.Sprintf("Policy.AddRule() [%s]", ruleName))
110+
return pol, errorsutil.Wrap(err, fmt.Sprintf("Policy.AddRule() [%s]", ruleName))
111111
}
112112
/*
113113
if err := pol.addRuleWithPriorError(stdRules.Rule(ruleName, ruleCfg.Severity)); err != nil {
114-
return pol, errors.Wrap(err, fmt.Sprintf("pol.addRuleWithPriorError [%s]", ruleName))
114+
return pol, errorsutil.Wrap(err, fmt.Sprintf("pol.addRuleWithPriorError [%s]", ruleName))
115115
}*/
116116
}
117117
}
@@ -123,13 +123,13 @@ func (cfg *PolicyConfig) Policy() (Policy, error) {
123123
ruleCollectionsMap[ruleName] = append(ruleCollectionsMap[ruleName], collection.Name())
124124
rule, err := collection.Rule(ruleName)
125125
if err != nil {
126-
return pol, errors.Wrap(err, "collection rule exists but not found. PolicyConfig.Policy()")
126+
return pol, errorsutil.Wrap(err, "collection rule exists but not found. PolicyConfig.Policy()")
127127
}
128128
if err = pol.AddRule(rule, ruleCfg.Severity, true); err != nil {
129-
return pol, errors.Wrap(err, fmt.Sprintf("Policy.AddRule() [%s]", ruleName))
129+
return pol, errorsutil.Wrap(err, fmt.Sprintf("Policy.AddRule() [%s]", ruleName))
130130
}
131131
/*if err := pol.addRuleWithPriorError(collection.Rule(ruleName, ruleCfg.Severity)); err != nil {
132-
return pol, errors.Wrap(err, fmt.Sprintf("pol.addRuleWithPriorError [%s]", ruleName))
132+
return pol, errorsutil.Wrap(err, fmt.Sprintf("pol.addRuleWithPriorError [%s]", ruleName))
133133
}*/
134134
}
135135
}
@@ -145,7 +145,7 @@ func (cfg *PolicyConfig) Policy() (Policy, error) {
145145
if len(collisions) > 0 {
146146
bytes, err := json.Marshal(collisions)
147147
if err != nil {
148-
return pol, errors.Wrap(err, fmt.Sprintf("json.Marshal [%s]", string(bytes)))
148+
return pol, errorsutil.Wrap(err, fmt.Sprintf("json.Marshal [%s]", string(bytes)))
149149
}
150150
return pol, fmt.Errorf("rule collisions: %s", string(bytes))
151151
}

postman2/collection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"encoding/json"
55
"strings"
66

7+
"github.com/grokify/mogo/errors/errorsutil"
78
"github.com/grokify/mogo/net/httputilmore"
8-
"github.com/pkg/errors"
99
)
1010

1111
const (
@@ -23,7 +23,7 @@ func NewCollectionFromBytes(data []byte) (Collection, error) {
2323
col := Collection{}
2424
err := json.Unmarshal(data, &col)
2525
if err != nil {
26-
err = errors.Wrap(err, "spectrum.postman2.NewCollectionFromBytes << json.Unmarshal")
26+
err = errorsutil.Wrap(err, "spectrum.postman2.NewCollectionFromBytes << json.Unmarshal")
2727
return col, err
2828
}
2929
col.Inflate()

postman2/simple/postman_collection_v2_simple.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"io/ioutil"
66
"strings"
77

8+
"github.com/grokify/mogo/errors/errorsutil"
89
"github.com/grokify/mogo/net/httputilmore"
910
"github.com/grokify/spectrum/postman2"
10-
"github.com/pkg/errors"
1111
)
1212

1313
type Collection struct {
@@ -19,7 +19,7 @@ func NewCollectionFromBytes(data []byte) (Collection, error) {
1919
pman := Collection{}
2020
err := json.Unmarshal(data, &pman)
2121
if err != nil {
22-
err = errors.Wrap(err, "spectrum.postman2.simple.NewCollectionFromBytes << json.Unmarshal")
22+
err = errorsutil.Wrap(err, "spectrum.postman2.simple.NewCollectionFromBytes << json.Unmarshal")
2323
}
2424
return pman, err
2525
}
@@ -32,8 +32,8 @@ func NewCanonicalCollectionFromBytes(data []byte) (postman2.Collection, error) {
3232
}
3333
simpleCollection, err := NewCollectionFromBytes(data)
3434
if err != nil {
35-
err = errors.Wrap(errTry, err.Error())
36-
err = errors.Wrap(err, "spectrum.postman2.simple.NewCanonicalCollectionFromBytes << NewCollectionFromBytes")
35+
err = errorsutil.Wrap(errTry, err.Error())
36+
err = errorsutil.Wrap(err, "spectrum.postman2.simple.NewCanonicalCollectionFromBytes << NewCollectionFromBytes")
3737
return collection, err
3838
}
3939
collection = simpleCollection.ToCanonical()
@@ -45,7 +45,7 @@ func NewCanonicalCollectionFromBytes(data []byte) (postman2.Collection, error) {
4545
func ReadCanonicalCollection(filepath string) (postman2.Collection, error) {
4646
bytes, err := ioutil.ReadFile(filepath)
4747
if err != nil {
48-
err = errors.Wrap(err, "spectrum.postman2.ReadCanonicalCollection << ioutil.ReadFile")
48+
err = errorsutil.Wrap(err, "spectrum.postman2.ReadCanonicalCollection << ioutil.ReadFile")
4949
return postman2.Collection{}, err
5050
}
5151
return NewCanonicalCollectionFromBytes(bytes)

spectrum.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"log"
66
"strings"
77

8+
"github.com/grokify/mogo/errors/errorsutil"
89
"github.com/grokify/spectrum/openapi3"
910
"github.com/grokify/spectrum/openapi3/openapi3postman2"
1011
"github.com/jessevdk/go-flags"
11-
"github.com/pkg/errors"
1212
)
1313

1414
// Convert yaml2json: https://github.com/bronze1man/yaml2json ... yaml2json_darwin_amd64
@@ -46,7 +46,7 @@ func main() {
4646
if len(opts.Config) > 0 {
4747
cfg3, err = openapi3postman2.ConfigurationReadFile(opts.Config)
4848
if err != nil {
49-
errors.Wrap(err, "openapi3postman2.ConfigurationReadFile")
49+
errorsutil.Wrap(err, "openapi3postman2.ConfigurationReadFile")
5050
log.Fatal(err)
5151
}
5252
}
@@ -61,7 +61,7 @@ func main() {
6161
opts.Postman)
6262

6363
if err != nil {
64-
errors.Wrap(err, "spectrum.main << conv.MergeConvert")
64+
errorsutil.Wrap(err, "spectrum.main << conv.MergeConvert")
6565
log.Fatal(err)
6666
}
6767

0 commit comments

Comments
 (0)