Skip to content

Commit 9317020

Browse files
committed
close to not return an error
1 parent 9a3d811 commit 9317020

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

coderd/files/cache.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package files
33
import (
44
"bytes"
55
"context"
6-
"io"
76
"io/fs"
87
"sync"
98

@@ -142,8 +141,7 @@ type cacheEntry struct {
142141
type fetcher func(context.Context, uuid.UUID) (CacheEntryValue, error)
143142

144143
var (
145-
_ fs.FS = (*CloseFS)(nil)
146-
_ io.Closer = (*CloseFS)(nil)
144+
_ fs.FS = (*CloseFS)(nil)
147145
)
148146

149147
// CloseFS is a wrapper around fs.FS that implements io.Closer. The Close()
@@ -152,10 +150,10 @@ var (
152150
type CloseFS struct {
153151
fs.FS
154152

155-
close func() error
153+
close func()
156154
}
157155

158-
func (f *CloseFS) Close() error { return f.close() }
156+
func (f *CloseFS) Close() { f.close() }
159157

160158
// Acquire will load the fs.FS for the given file. It guarantees that parallel
161159
// calls for the same fileID will only result in one fetch, and that parallel
@@ -187,11 +185,10 @@ func (c *Cache) Acquire(ctx context.Context, fileID uuid.UUID) (*CloseFS, error)
187185
var once sync.Once
188186
return &CloseFS{
189187
FS: it.FS,
190-
close: func() error {
188+
close: func() {
191189
// sync.Once makes the Close() idempotent, so we can call it
192190
// multiple times without worrying about double-releasing.
193191
once.Do(func() { c.release(fileID) })
194-
return nil
195192
},
196193
}, nil
197194
}

0 commit comments

Comments
 (0)