Skip to content
Closed
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
20 changes: 10 additions & 10 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,16 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/errors/com_github_cockroachdb_errors-v1.9.0.zip",
],
)
go_repository(
name = "com_github_cockroachdb_go_bindata",
build_file_proto_mode = "disable_global",
importpath = "github.com/cockroachdb/go-bindata",
sha256 = "aa9eb6adc4628360ccd0a2421c6c4dc0c58fea2ca27459971d644f55d7a2613c",
strip_prefix = "github.com/cockroachdb/[email protected]",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/go-bindata/com_github_cockroachdb_go_bindata-v0.0.0-20220907094433-aa69f7239e7a.zip",
],
)
go_repository(
name = "com_github_cockroachdb_go_test_teamcity",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -4965,16 +4975,6 @@ def go_deps():
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kballard/go-shellquote/com_github_kballard_go_shellquote-v0.0.0-20180428030007-95032a82bc51.zip",
],
)
go_repository(
name = "com_github_kevinburke_go_bindata",
build_file_proto_mode = "disable_global",
importpath = "github.com/kevinburke/go-bindata",
sha256 = "f087b3a77624a113883bac519ebd1a4de07b70ab2ebe73e61e52325ac30777e0",
strip_prefix = "github.com/kevinburke/[email protected]+incompatible",
urls = [
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kevinburke/go-bindata/com_github_kevinburke_go_bindata-v3.13.0+incompatible.zip",
],
)
go_repository(
name = "com_github_kisielk_errcheck",
build_file_proto_mode = "disable_global",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ bin/.bootstrap: $(GITHOOKS) vendor/modules.txt | bin/.submodules-initialized
github.com/goware/modvendor \
github.com/go-swagger/go-swagger/cmd/swagger \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
github.com/kevinburke/go-bindata/go-bindata \
github.com/cockroachdb/go-bindata/go-bindata \
github.com/kisielk/errcheck \
github.com/mattn/goveralls \
github.com/mibk/dupl \
Expand Down
2 changes: 1 addition & 1 deletion build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/crlfmt/com_github_cockroachdb_crlfmt-v0.0.0-20210128092314-b3eff0b87c79.zip": "452219ca74191eedc6f44a5088b5d64e6f75168b438ac9eafe2256b0db8dbcad",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/datadriven/com_github_cockroachdb_datadriven-v1.0.1.zip": "0f8fe6199b1c7c44cbd4ce9ac0f3f9e1d2f02263f409361e49445fad4a410ab8",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/errors/com_github_cockroachdb_errors-v1.9.0.zip": "ff3814544271799c80da14dadfe408efc4f66e02cbdf17b73e81614ed9f7ae43",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/go-bindata/com_github_cockroachdb_go_bindata-v0.0.0-20220907094433-aa69f7239e7a.zip": "aa9eb6adc4628360ccd0a2421c6c4dc0c58fea2ca27459971d644f55d7a2613c",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/go-test-teamcity/com_github_cockroachdb_go_test_teamcity-v0.0.0-20191211140407-cff980ad0a55.zip": "bac30148e525b79d004da84d16453ddd2d5cd20528e9187f1d7dac708335674b",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.13.0.zip": "b3d43d8f95edf65f73a5348f29e1159823cac64b148f8d3bb48340bf55d70872",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/logtags/com_github_cockroachdb_logtags-v0.0.0-20211118104740-dabe8e521a4f.zip": "1972c3f171f118add3fd9e64bcea6cbb9959a3b7fa0ada308e8a7310813fea74",
Expand Down Expand Up @@ -532,7 +533,6 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kataras/pio/com_github_kataras_pio-v0.0.2.zip": "ccec5930116d9b46e338e39fd15404b737d1a7baffb65b6247280a37a9ef9e23",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kataras/sitemap/com_github_kataras_sitemap-v0.0.5.zip": "5e86f8ab488803b503071dfa6b678ad7eb61f1155ddc2b8844798f04d3a927d0",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kballard/go-shellquote/com_github_kballard_go_shellquote-v0.0.0-20180428030007-95032a82bc51.zip": "ae4cb7b097dc4eb0c248dff00ed3bbf0f36984c4162ad1d615266084e58bd6cc",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kevinburke/go-bindata/com_github_kevinburke_go_bindata-v3.13.0+incompatible.zip": "f087b3a77624a113883bac519ebd1a4de07b70ab2ebe73e61e52325ac30777e0",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kisielk/errcheck/com_github_kisielk_errcheck-v1.6.1-0.20210625163953-8ddee489636a.zip": "99d3220891162cb684f8e05d54f3d0dc58abdd496a2f0cfda7fd4a28917a719e",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/kisielk/gotool/com_github_kisielk_gotool-v1.0.0.zip": "089dbba6e3aa09944fdb40d72acc86694e8bdde01cfc0f40fe0248309eb80a3f",
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.14.2.zip": "25990a3b573b4568fa9c98c880e82abe5fe4dc6a3c784935923643ef28791acd",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ require (
github.com/cockroachdb/crlfmt v0.0.0-20210128092314-b3eff0b87c79
github.com/cockroachdb/datadriven v1.0.1
github.com/cockroachdb/errors v1.9.0
github.com/cockroachdb/go-bindata v0.0.0-20220907094433-aa69f7239e7a
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55
github.com/cockroachdb/gostdlib v1.13.0
github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f
Expand Down Expand Up @@ -98,7 +99,6 @@ require (
github.com/jaegertracing/jaeger v1.18.1
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
github.com/jordanlewis/gcassert v0.0.0-20210709222130-81f5df3faab8
github.com/kevinburke/go-bindata v3.13.0+incompatible
github.com/kisielk/errcheck v1.6.1-0.20210625163953-8ddee489636a
github.com/kisielk/gotool v1.0.0
github.com/knz/go-libedit v1.10.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ github.com/cockroachdb/errors v1.8.8/go.mod h1:z6VnEL3hZ/2ONZEvG7S5Ym0bU2AqPcEKn
github.com/cockroachdb/errors v1.8.9/go.mod h1:vaNcEYYqbIqB5JhKBhFV9CneUqeuEbB2OYJBK4GBNYQ=
github.com/cockroachdb/errors v1.9.0 h1:B48dYem5SlAY7iU8AKsgedb4gH6mo+bDkbtLIvM/a88=
github.com/cockroachdb/errors v1.9.0/go.mod h1:vaNcEYYqbIqB5JhKBhFV9CneUqeuEbB2OYJBK4GBNYQ=
github.com/cockroachdb/go-bindata v0.0.0-20220907094433-aa69f7239e7a h1:g3E7/4/yOukMEwuScd5+UsPISdTpdHV9ZyqxYYK4e8Y=
github.com/cockroachdb/go-bindata v0.0.0-20220907094433-aa69f7239e7a/go.mod h1:fOV1JHch1f33Nb8wQ0Tarl/W2gAOd103ydO9fUedX5c=
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55 h1:YqzBA7tf8Gv8Oz0BbBsPenqkyjiohS7EUIwi7p1QJCU=
github.com/cockroachdb/go-test-teamcity v0.0.0-20191211140407-cff980ad0a55/go.mod h1:QqVqNIiRhLqJXif5C9wbM4JydBhrAF2WDMxkv5xkyxQ=
github.com/cockroachdb/gostdlib v1.13.0 h1:TzSEPYgkKDNei3gbLc0rrHu4iHyBp7/+NxPOFmcXGaw=
Expand Down Expand Up @@ -1457,8 +1459,6 @@ github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7
github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kevinburke/go-bindata v3.13.0+incompatible h1:hThDhUBH4KjTyhfXfOgacEPfFBNjltnzl/xzfLfrPoQ=
github.com/kevinburke/go-bindata v3.13.0+incompatible/go.mod h1:/pEEZ72flUW2p0yi30bslSp9YqD9pysLxunQDdb2CPM=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/import-tools/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
_ "github.com/bufbuild/buf/cmd/buf"
_ "github.com/client9/misspell/cmd/misspell"
_ "github.com/cockroachdb/crlfmt"
_ "github.com/cockroachdb/go-bindata/go-bindata"
_ "github.com/cockroachdb/go-test-teamcity"
_ "github.com/cockroachdb/gostdlib/cmd/gofmt"
_ "github.com/cockroachdb/gostdlib/x/tools/cmd/goimports"
Expand All @@ -33,7 +34,6 @@ import (
_ "github.com/golang/mock/mockgen"
_ "github.com/goware/modvendor"
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway"
_ "github.com/kevinburke/go-bindata/go-bindata"
_ "github.com/kisielk/errcheck"
_ "github.com/mattn/goveralls"
_ "github.com/mibk/dupl"
Expand Down
17 changes: 10 additions & 7 deletions pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"fmt"
"io"
"io/fs"
"io/ioutil"
"math"
"os"
"os/exec"
Expand Down Expand Up @@ -1883,16 +1882,20 @@ func (c *SyncedCluster) Get(l *logger.Logger, nodes Nodes, src, dest string) err
return err
}

infos, err := ioutil.ReadDir(src)
direntries, err := os.ReadDir(src)
if err != nil {
return err
}

for _, info := range infos {
for _, entry := range direntries {
einfo, err := entry.Info()
if err != nil {
return err
}
if err := copy(
filepath.Join(src, info.Name()),
filepath.Join(dest, info.Name()),
info,
filepath.Join(src, einfo.Name()),
filepath.Join(dest, einfo.Name()),
einfo,
); err != nil {
return err
}
Expand Down Expand Up @@ -2221,7 +2224,7 @@ func (c *SyncedCluster) ParallelE(
var writer ui.Writer
out := l.Stdout
if display == "" {
out = ioutil.Discard
out = io.Discard
}

var ticker *time.Ticker
Expand Down
21 changes: 19 additions & 2 deletions pkg/security/securityassets/security_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package securityassets

import (
"io/ioutil"
"io/fs"
"os"

"github.com/cockroachdb/errors/oserror"
Expand All @@ -24,9 +24,26 @@ type Loader struct {
Stat func(name string) (os.FileInfo, error)
}

// TODO(knz): make ReadDir return a fs.DirEntry and remove this function.
func readDir(name string) ([]os.FileInfo, error) {
direntries, err := os.ReadDir(name)
if err != nil {
return nil, err
}
infos := make([]fs.FileInfo, 0, len(direntries))
for _, entry := range direntries {
info, err := entry.Info()
if err != nil {
return nil, err
}
infos = append(infos, info)
}
return infos, nil
}

// defaultLoader uses real filesystem calls.
var defaultLoader = Loader{
ReadDir: ioutil.ReadDir,
ReadDir: readDir,
ReadFile: os.ReadFile,
Stat: os.Stat,
}
Expand Down
21 changes: 19 additions & 2 deletions pkg/server/dumpstore/dumpstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package dumpstore

import (
"context"
"io/ioutil"
"io/fs"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -90,7 +90,7 @@ func (s *DumpStore) GetFullPath(fileName string) string {
func (s *DumpStore) GC(ctx context.Context, now time.Time, dumper Dumper) {
// NB: ioutil.ReadDir sorts the file names in ascending order.
// This brings the oldest files first.
files, err := ioutil.ReadDir(s.dir)
files, err := readDir(s.dir)
if err != nil {
log.Warningf(ctx, "%v", err)
return
Expand All @@ -116,6 +116,23 @@ func (s *DumpStore) GC(ctx context.Context, now time.Time, dumper Dumper) {
removeOldAndTooBigExcept(ctx, dumper, files, now, maxS, preserved, cleanupFn)
}

// TODO(knz): make PreFilter return a fs.DirEntry and remove this function.
func readDir(name string) ([]os.FileInfo, error) {
direntries, err := os.ReadDir(name)
if err != nil {
return nil, err
}
infos := make([]fs.FileInfo, 0, len(direntries))
for _, entry := range direntries {
info, err := entry.Info()
if err != nil {
return nil, err
}
infos = append(infos, info)
}
return infos, nil
}

// removeOldAndTooBigExcept looks at the entries in files and calls
// the fn closure for every entry not in the preserved map whose size
// causes the combined collection of files to exceed maxS.
Expand Down
3 changes: 1 addition & 2 deletions pkg/server/dumpstore/dumpstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package dumpstore
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -192,7 +191,7 @@ func populate(t *testing.T, dirName string, fileNames []string, sizes []int64) [
}

// Retrieve the file list for the remainder of the test.
files, err := ioutil.ReadDir(dirName)
files, err := readDir(dirName)
if err != nil {
t.Fatal(err)
}
Expand Down
21 changes: 19 additions & 2 deletions pkg/server/heapprofiler/profilestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package heapprofiler
import (
"context"
"fmt"
"io/ioutil"
"io/fs"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -225,9 +225,26 @@ func populate(t *testing.T, dirName string, fileNames []string) []os.FileInfo {
}

// Retrieve the file list for the remainder of the test.
files, err := ioutil.ReadDir(dirName)
files, err := readDir(dirName)
if err != nil {
t.Fatal(err)
}
return files
}

// TODO(knz): make populate return a fs.DirEntry and remove this function.
func readDir(name string) ([]os.FileInfo, error) {
direntries, err := os.ReadDir(name)
if err != nil {
return nil, err
}
infos := make([]fs.FileInfo, 0, len(direntries))
for _, entry := range direntries {
info, err := entry.Info()
if err != nil {
return nil, err
}
infos = append(infos, info)
}
return infos, nil
}
9 changes: 6 additions & 3 deletions pkg/util/log/file_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package log

import (
"io"
"io/ioutil"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -160,15 +159,19 @@ func (l *fileSink) listLogFiles() (string, []logpb.FileInfo, error) {
// log files.
return "", nil, nil
}
infos, err := ioutil.ReadDir(dir)
infos, err := os.ReadDir(dir)
if err != nil {
return "", results, err
}
// The file names have a fixed structure with fields delimited by
// periods. create() for new files removes the periods from the
// provided prefix; do the same here to filter out selected names
// below.
for _, info := range infos {
for _, dire := range infos {
info, err := dire.Info()
if err != nil {
return "", results, err
}
if info.Mode().IsRegular() {
details, err := ParseLogFilename(info.Name())
if err == nil && l.nameGenerator.ownsFileByPrefix(details.Program) {
Expand Down
2 changes: 1 addition & 1 deletion vendor
Submodule vendor updated 29 files
+0 −0 github.com/cockroachdb/go-bindata/.gitignore
+1 −0 github.com/cockroachdb/go-bindata/.mailmap
+5 −1 github.com/cockroachdb/go-bindata/AUTHORS.txt
+8 −0 github.com/cockroachdb/go-bindata/CHANGELOG.md
+0 −0 github.com/cockroachdb/go-bindata/CONTRIBUTING.md
+0 −0 github.com/cockroachdb/go-bindata/LICENSE
+83 −0 github.com/cockroachdb/go-bindata/Makefile
+20 −9 github.com/cockroachdb/go-bindata/README.md
+0 −0 github.com/cockroachdb/go-bindata/asset.go
+0 −0 github.com/cockroachdb/go-bindata/bits.go
+0 −0 github.com/cockroachdb/go-bindata/bytewriter.go
+24 −24 github.com/cockroachdb/go-bindata/config.go
+69 −50 github.com/cockroachdb/go-bindata/convert.go
+5 −6 github.com/cockroachdb/go-bindata/debug.go
+4 −4 github.com/cockroachdb/go-bindata/doc.go
+31 −0 github.com/cockroachdb/go-bindata/filewriter.go
+0 −0 github.com/cockroachdb/go-bindata/go-bindata/AppendSliceValue.go
+9 −6 github.com/cockroachdb/go-bindata/go-bindata/main.go
+5 −2 github.com/cockroachdb/go-bindata/go-bindata/version.go
+32 −19 github.com/cockroachdb/go-bindata/release.go
+5 −0 github.com/cockroachdb/go-bindata/release_go112.go
+5 −0 github.com/cockroachdb/go-bindata/release_go113.go
+1 −1 github.com/cockroachdb/go-bindata/restore.go
+1 −1 github.com/cockroachdb/go-bindata/safefile.go
+0 −0 github.com/cockroachdb/go-bindata/stringwriter.go
+29 −14 github.com/cockroachdb/go-bindata/toc.go
+0 −17 github.com/kevinburke/go-bindata/.travis.yml
+0 −72 github.com/kevinburke/go-bindata/Makefile
+4 −4 modules.txt