We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e603756 commit 5cb6eebCopy full SHA for 5cb6eeb
txtar/fs.go
@@ -10,6 +10,7 @@ import (
10
"io"
11
"io/fs"
12
"path"
13
+ "slices"
14
"time"
15
)
16
@@ -152,10 +153,7 @@ func (fsys *filesystem) ReadFile(name string) ([]byte, error) {
152
153
return nil, err
154
}
155
if file, ok := file.(*openFile); ok {
- // TODO: use slices.Clone once x/tools has 1.21 available.
156
- cp := make([]byte, file.size)
157
- copy(cp, file.data)
158
- return cp, err
+ return slices.Clone(file.data), nil
159
160
return nil, &fs.PathError{Op: "read", Path: name, Err: fs.ErrInvalid}
161
0 commit comments