Skip to content

Commit 51c49e0

Browse files
fix lint errors
1 parent 3fc1445 commit 51c49e0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

extension/storage/filestorage/extension.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ func newLocalFileStorage(logger *zap.Logger, config *Config) (extension.Extensio
4242
}, nil
4343
}
4444

45-
// Start does nothing
45+
// Start runs cleanup if configured
4646
func (lfs *localFileStorage) Start(context.Context, component.Host) error {
4747
if lfs.cfg.Compaction.CleanupOnStart {
48-
lfs.cleanup(lfs.cfg.Compaction.Directory)
48+
return lfs.cleanup(lfs.cfg.Compaction.Directory)
4949
}
5050
return nil
5151
}
@@ -142,11 +142,11 @@ func isSafe(character rune) bool {
142142
}
143143

144144
// cleanup left compaction temporary files from previous killed process
145-
func (c *localFileStorage) cleanup(compactionDirectory string) error {
145+
func (lfs *localFileStorage) cleanup(compactionDirectory string) error {
146146
pattern := filepath.Join(compactionDirectory, fmt.Sprintf("%s*", TempDbPrefix))
147147
contents, err := filepath.Glob(pattern)
148148
if err != nil {
149-
c.logger.Info("cleanup error listing temporary files",
149+
lfs.logger.Info("cleanup error listing temporary files",
150150
zap.Error(err))
151151
return err
152152
}
@@ -155,14 +155,14 @@ func (c *localFileStorage) cleanup(compactionDirectory string) error {
155155
for _, item := range contents {
156156
err = os.Remove(item)
157157
if err == nil {
158-
c.logger.Debug("cleanup",
158+
lfs.logger.Debug("cleanup",
159159
zap.String("deletedFile", item))
160160
} else {
161161
errs = append(errs, err)
162162
}
163163
}
164164
if errs != nil {
165-
c.logger.Info("cleanup errors",
165+
lfs.logger.Info("cleanup errors",
166166
zap.Error(errors.Join(errs...)))
167167
}
168168
return nil

0 commit comments

Comments
 (0)