Skip to content

Commit e065ac9

Browse files
authored
Merge pull request #328 from flokli/no-cache-fix
fix: only try opening the cache if cache is enabled
2 parents ab9f831 + 601af09 commit e065ac9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cli/format.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ func (f *Format) Run() (err error) {
118118
f.formatters[name] = formatter
119119
}
120120

121-
// open the cache
122-
if err = cache.Open(f.TreeRoot, f.ClearCache, f.formatters); err != nil {
123-
return err
121+
// open the cache if configured
122+
if !f.NoCache {
123+
if cache.Open(f.TreeRoot, f.ClearCache, f.formatters); err != nil {
124+
return err
125+
}
124126
}
125127

126128
// create an app context and listen for shutdown
@@ -148,7 +150,9 @@ func (f *Format) Run() (err error) {
148150
f.processedCh = make(chan *walk.File, cap(f.filesCh))
149151

150152
// start concurrent processing tasks in reverse order
151-
eg.Go(f.updateCache(ctx))
153+
if !f.NoCache {
154+
eg.Go(f.updateCache(ctx))
155+
}
152156
eg.Go(f.applyFormatters(ctx))
153157
eg.Go(f.walkFilesystem(ctx))
154158

0 commit comments

Comments
 (0)