Skip to content

Commit fa44949

Browse files
committed
Avoid some unnecessary buffering when reading config file
1 parent 115c8df commit fa44949

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/cmd/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ func readConfig(stderr io.Writer, dir, filename string) (string, *config.Config,
100100
}
101101

102102
base := filepath.Base(configPath)
103-
blob, err := os.ReadFile(configPath)
103+
file, err := os.Open(configPath)
104104
if err != nil {
105105
fmt.Fprintf(stderr, "error parsing %s: file does not exist\n", base)
106106
return "", nil, err
107107
}
108108

109-
conf, err := config.ParseConfig(bytes.NewReader(blob))
109+
conf, err := config.ParseConfig(file)
110110
if err != nil {
111111
switch err {
112112
case config.ErrMissingVersion:

0 commit comments

Comments
 (0)