Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-20 15:12:48 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-09-20 17:23:54 +0300
commit4d63c8f0bfb5874ba2a9a68be0b3d73d9669cd09 (patch)
treed68ad0aa219b0655140ddaa40bb135fe643c5714 /proto
parentd54f7f25a1c8d3eba3ac66f62c56d599ca36986b (diff)
global: Replace trivial cases of deprecated `ioutil.ReadDir()`
With Go 1.16, the ioutil package was deprecated. In addition to being moved into the os package, `ioutil.ReadDir()` was also changed to not stat(3P) all dir entries anymore. As a result, the caller now has to do so manually. This is a performance improvement in some cases where the caller didn't require any of the file information, but really only wanted to read the directory's entries. Adapt trivial usecases of `ioutil.ReadDir()` which do not require this information with usage of `os.ReadDir()`. This leaves a few callsites of the old `ioutil.ReadDir()` function for future conversion.
Diffstat (limited to 'proto')
-rw-r--r--proto/go/internal/cmd/protoc-gen-gitaly/main.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/proto/go/internal/cmd/protoc-gen-gitaly/main.go b/proto/go/internal/cmd/protoc-gen-gitaly/main.go
index a364b68ee..efe8a312e 100644
--- a/proto/go/internal/cmd/protoc-gen-gitaly/main.go
+++ b/proto/go/internal/cmd/protoc-gen-gitaly/main.go
@@ -55,7 +55,6 @@ import (
"fmt"
"go/format"
"io"
- "io/ioutil"
"log"
"os"
"path/filepath"
@@ -156,7 +155,7 @@ func generateProtolistGo(req *pluginpb.CodeGeneratorRequest) error {
return fmt.Errorf("failed to get absolute path for %s: %v", gitalyProtoDir, err)
}
- files, err := ioutil.ReadDir(gitalyProtoDir)
+ files, err := os.ReadDir(gitalyProtoDir)
if err != nil {
return fmt.Errorf("failed to read %s: %v", gitalyProtoDir, err)
}