chore: linted

This commit is contained in:
2025-11-25 15:52:38 +03:00
parent 4876ba5954
commit a857f12cb5
8 changed files with 29 additions and 27 deletions

View File

@@ -43,15 +43,15 @@ var (
type wholeScreenCapturer struct {
config *config.Config
log *logger.Logger
log *logger.Logger
displayIndex int
displayBounds image.Rectangle
interval int
bufferCount int
displayIndex int
displayBounds image.Rectangle
interval int
bufferCount int
tempDirectory string
initialized bool
running bool
initialized bool
running bool
files []string
latest string
@@ -189,7 +189,7 @@ func (w *wholeScreenCapturer) captureAndSave() (string, error) {
func (w *wholeScreenCapturer) addToBuffer(fp string) {
w.mu.Lock()
defer w.mu.Unlock()
defer w.mu.Unlock()
w.files = append(w.files, fp)
w.latest = fp
@@ -208,20 +208,22 @@ func (w *wholeScreenCapturer) createTempDirectory() (path string, err error) {
return os.MkdirTemp(w.config.Screenshot.Directory, constants.AppName+"-*")
}
func NewWholeScreenCapturer(lc fx.Lifecycle, config *config.Config, log *logger.Logger) ScreenCapturer {
func NewWholeScreenCapturer(
lc fx.Lifecycle, config *config.Config, log *logger.Logger,
) ScreenCapturer {
capturer := &wholeScreenCapturer{
config: config,
log: log,
done: make(chan struct{}),
}
lc.Append(fx.StopHook(func(ctx context.Context) error {
if (!capturer.initialized) {
if !capturer.initialized {
log.Debug("wholescreencapturer not initialized, nothing to do")
return nil
}
log.Debug("stopping wholescreencapturer")
err := capturer.Stop()
if err != nil {
log.Error("failed to stop wholescreencapturer gracefully")
@@ -237,4 +239,3 @@ func NewWholeScreenCapturer(lc fx.Lifecycle, config *config.Config, log *logger.
}))
return capturer
}