@@ -368,7 +368,7 @@ type Config struct {
368
368
369
369
// We need to keep this object around, otherwise it gets GC'd and the
370
370
// finalizer will run, probably closing the lock.
371
- configLock * flock.Flock
371
+ cacheLock * flock.Flock
372
372
373
373
LogLevel log.Level `koanf:"log_level"`
374
374
DeviceId string `koanf:"device_id"`
@@ -455,18 +455,18 @@ func loadConfig(cfg *Config) error {
455
455
return err
456
456
}
457
457
458
- // Make config directory if needed.
458
+ // Make cache directory if needed.
459
459
err = os .MkdirAll (cfg .CacheDir , 0o700 )
460
460
if err != nil {
461
- return fmt .Errorf ("failed creating config directory: %w" , err )
461
+ return fmt .Errorf ("failed creating cache directory: %w" , err )
462
462
}
463
463
464
- // Lock the config directory (to ensure multiple instances won't clobber
464
+ // Lock the cache directory (to ensure multiple instances won't clobber
465
465
// each others state).
466
466
lockFilePath := filepath .Join (cfg .CacheDir , "lockfile" )
467
- cfg .configLock = flock .New (lockFilePath )
468
- if locked , err := cfg .configLock .TryLock (); err != nil {
469
- return fmt .Errorf ("could not lock config directory: %w" , err )
467
+ cfg .cacheLock = flock .New (lockFilePath )
468
+ if locked , err := cfg .cacheLock .TryLock (); err != nil {
469
+ return fmt .Errorf ("could not lock cache directory: %w" , err )
470
470
} else if ! locked {
471
471
// Lock already taken! Looks like go-librespot is already running.
472
472
return fmt .Errorf ("%w (lockfile: %s)" , errAlreadyRunning , lockFilePath )
0 commit comments