Skip to content

Commit 9354f1c

Browse files
committed
dep: go mod: update
1 parent 86b807b commit 9354f1c

File tree

7 files changed

+38
-26
lines changed

7 files changed

+38
-26
lines changed

cmd/oas3lint/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"regexp"
77

88
"github.com/grokify/simplego/fmt/fmtutil"
9-
"github.com/grokify/simplego/io/ioutilmore"
109
"github.com/grokify/simplego/log/severity"
10+
"github.com/grokify/simplego/os/osutil"
1111
"github.com/grokify/simplego/path/filepathutil"
1212
"github.com/grokify/spectrum/openapi3"
1313
"github.com/grokify/spectrum/openapi3lint"
@@ -32,16 +32,17 @@ func main() {
3232

3333
var files []string
3434
if len(opts.InputFileOAS3) > 0 {
35-
isDir, err := ioutilmore.IsDir(opts.InputFileOAS3)
35+
isDir, err := osutil.IsDir(opts.InputFileOAS3)
3636
if err != nil {
3737
log.Fatal(err)
3838
}
3939
if isDir {
40-
_, files, err = ioutilmore.ReadDirMore(opts.InputFileOAS3,
41-
regexp.MustCompile(`(?i)\.(json|yaml|yml)$`), true, true)
40+
entries, err := osutil.ReadDirMore(opts.InputFileOAS3,
41+
regexp.MustCompile(`(?i)\.(json|yaml|yml)$`), false, true, false)
4242
if err != nil {
4343
log.Fatal(err)
4444
}
45+
files = osutil.DirEntrySlice(entries).Names(opts.InputFileOAS3, true)
4546
} else {
4647
files = []string{opts.InputFileOAS3}
4748
}

cmd/openapi2csv/main.go

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

8-
"github.com/grokify/simplego/io/ioutilmore"
8+
"github.com/grokify/simplego/os/osutil"
99
csv "github.com/grokify/spectrum/openapi2/openapi2csv"
1010
"github.com/jessevdk/go-flags"
1111
)
@@ -23,11 +23,12 @@ func main() {
2323
log.Fatal(err)
2424
}
2525

26-
_, filepaths, err := ioutilmore.ReadDirMore(
27-
opts.Directory, regexp.MustCompile(opts.Regexp), true, true)
26+
entries, err := osutil.ReadDirMore(
27+
opts.Directory, regexp.MustCompile(opts.Regexp), false, true, false)
2828
if err != nil {
2929
log.Fatal(err)
3030
}
31+
filepaths := osutil.DirEntrySlice(entries).Names(opts.Directory, true)
3132
tbl, err := csv.TableFromSpecFiles(filepaths, true)
3233
if err != nil {
3334
log.Fatal(fmt.Sprintf("TableFromSpecFiles [%v]\n", err.Error()))

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/getkin/kin-openapi v0.65.0
88
github.com/ghodss/yaml v1.0.0
99
github.com/grokify/gocharts v1.9.0
10-
github.com/grokify/simplego v0.26.10
10+
github.com/grokify/simplego v0.27.2
1111
github.com/jessevdk/go-flags v1.5.0
1212
github.com/pkg/errors v0.9.1
1313
github.com/rs/zerolog v1.23.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ github.com/grokify/elastirad-go v0.1.1/go.mod h1:Zmb82d9GAyzakccUFhY9Ojf3QjkmPyJ
204204
github.com/grokify/gocharts v1.9.0 h1:pBlWd1NPethRBJ0WO17WkY5ezMo/BXfBj5dJj6aH5Ls=
205205
github.com/grokify/gocharts v1.9.0/go.mod h1:L69qGvVjBaWFgxT6Wpjb/oJURmzEGnVQ+M4hJ+ndQDQ=
206206
github.com/grokify/simplego v0.26.8/go.mod h1:UKobvO2/X3aFy5fwNUxaW6YFK8A3IKCoIRqtVNhsdZU=
207-
github.com/grokify/simplego v0.26.10 h1:CZugzr9b6mpxb/MaI3aAFWYGBgbZDFIMt7uZKDYe1p8=
208-
github.com/grokify/simplego v0.26.10/go.mod h1:UKobvO2/X3aFy5fwNUxaW6YFK8A3IKCoIRqtVNhsdZU=
207+
github.com/grokify/simplego v0.27.2 h1:Njc9k/yZNOco3vWpJNCoMDL6mTrjnbKzRvaLHJxlZf8=
208+
github.com/grokify/simplego v0.27.2/go.mod h1:UKobvO2/X3aFy5fwNUxaW6YFK8A3IKCoIRqtVNhsdZU=
209209
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
210210
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
211211
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=

openapi2/merge.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ import (
88
"strings"
99

1010
"github.com/grokify/simplego/io/ioutilmore"
11+
"github.com/grokify/simplego/os/osutil"
1112
"github.com/pkg/errors"
1213
)
1314

1415
var jsonFileRx = regexp.MustCompile(`(?i)\.json\s*$`)
1516

1617
func MergeDirectory(dir string) (Specification, error) {
17-
fileInfos, err := ioutilmore.DirEntriesRxSizeGt0(dir, ioutilmore.File, jsonFileRx)
18+
//fileInfos, err := ioutilmore.DirEntriesRxSizeGt0(dir, ioutilmore.File, jsonFileRx)
19+
entries, err := osutil.ReadDirMore(dir, jsonFileRx, false, true, false)
1820
if err != nil {
1921
return Specification{}, err
2022
}
21-
if len(fileInfos) == 0 {
22-
return Specification{}, fmt.Errorf("No JSON files found in directory [%s]", dir)
23+
if len(entries) == 0 {
24+
return Specification{}, fmt.Errorf("no JSON files found in directory [%s]", dir)
2325
}
2426
var specMaster Specification
25-
for i, fi := range fileInfos {
26-
thisSpecFilepath := filepath.Join(dir, fi.Name())
27+
for i, entry := range entries {
28+
thisSpecFilepath := filepath.Join(dir, entry.Name())
2729
thisSpec, err := ReadOpenAPI2SpecFileDirect(thisSpecFilepath)
2830
if err != nil {
2931
return specMaster, err

openapi3/merge.go

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

1212
oas3 "github.com/getkin/kin-openapi/openapi3"
1313
"github.com/grokify/gocharts/data/table"
14-
"github.com/grokify/simplego/io/ioutilmore"
14+
"github.com/grokify/simplego/os/osutil"
1515
"github.com/pkg/errors"
1616
)
1717

1818
var jsonFileRx = regexp.MustCompile(`(?i)\.(json|yaml|yml)\s*$`)
1919

2020
func MergeDirectory(dir string, mergeOpts *MergeOptions) (*Spec, int, error) {
21-
var filePaths []string
21+
var filenames []string
2222
var err error
2323
if mergeOpts != nil && mergeOpts.FileRx != nil {
24-
_, filePaths, err = ioutilmore.ReadDirMore(dir, mergeOpts.FileRx, true, true)
24+
entries, err := osutil.ReadDirMore(dir, mergeOpts.FileRx, false, true, false)
25+
if err != nil {
26+
filenames = osutil.DirEntrySlice(entries).Names(dir, true)
27+
}
28+
//_, filenames, err = ioutilmore.ReadDirMore(dir, mergeOpts.FileRx, true, true)
2529
} else {
26-
_, filePaths, err = ioutilmore.ReadDirMore(dir, jsonFileRx, true, true)
30+
entries, err := osutil.ReadDirMore(dir, jsonFileRx, false, true, false)
31+
if err != nil {
32+
filenames = osutil.DirEntrySlice(entries).Names(dir, true)
33+
}
34+
//_, filenames, err = ioutilmore.ReadDirMore(dir, jsonFileRx, true, true)
2735
}
2836

2937
if err != nil {
30-
return nil, len(filePaths), err
38+
return nil, len(filenames), err
3139
}
3240

33-
spec, err := MergeFiles(filePaths, mergeOpts)
34-
return spec, len(filePaths), err
41+
spec, err := MergeFiles(filenames, mergeOpts)
42+
return spec, len(filenames), err
3543
}
3644

3745
func MergeFiles(filepaths []string, mergeOpts *MergeOptions) (*Spec, error) {

openapi3/spec_meta.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
"strings"
66

77
oas3 "github.com/getkin/kin-openapi/openapi3"
8-
"github.com/grokify/simplego/io/ioutilmore"
8+
"github.com/grokify/simplego/os/osutil"
99
)
1010

1111
const (
12-
OASVersionLatest = "3.0.3"
12+
OASVersionLatest = "3.1.0"
1313
apiVersionDefault = "0.0.1"
1414
)
1515

@@ -59,13 +59,13 @@ type SpecMeta struct {
5959

6060
func ReadSpecMetasDir(dir string, rx *regexp.Regexp) (SpecMetas, error) {
6161
metas := SpecMetas{Metas: []SpecMeta{}}
62-
_, files, err := ioutilmore.ReadDirMore(dir, rx, true, true)
62+
entries, err := osutil.ReadDirMore(dir, rx, false, true, false)
6363

6464
if err != nil {
6565
return metas, err
6666
}
6767

68-
return ReadSpecMetasFiles(files)
68+
return ReadSpecMetasFiles(osutil.DirEntrySlice(entries).Names(dir, true))
6969
}
7070

7171
func ReadSpecMetasFiles(files []string) (SpecMetas, error) {

0 commit comments

Comments
 (0)