slog.Error arg err should be a string or a slog.Attr

This commit is contained in:
rafaelDev0ps 2024-11-11 10:09:18 -03:00
parent b3834bf559
commit 45d1b52146

View file

@ -1,17 +1,18 @@
package main package main
import ( import (
"github.com/fsnotify/fsnotify"
"github.com/google/uuid"
"github.com/maddalax/htmgo/cli/htmgo/internal"
"github.com/maddalax/htmgo/cli/htmgo/internal/dirutil"
"github.com/maddalax/htmgo/cli/htmgo/tasks/module"
"log" "log"
"log/slog" "log/slog"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
"github.com/fsnotify/fsnotify"
"github.com/google/uuid"
"github.com/maddalax/htmgo/cli/htmgo/internal"
"github.com/maddalax/htmgo/cli/htmgo/internal/dirutil"
"github.com/maddalax/htmgo/cli/htmgo/tasks/module"
) )
func startWatcher(cb func(version string, file []*fsnotify.Event)) { func startWatcher(cb func(version string, file []*fsnotify.Event)) {
@ -118,7 +119,7 @@ func startWatcher(cb func(version string, file []*fsnotify.Event)) {
if info.IsDir() { if info.IsDir() {
err = watcher.Add(path) err = watcher.Add(path)
if err != nil { if err != nil {
slog.Error("Error adding directory to watcher:", err) slog.Error("Error adding directory to watcher:", err.Error())
} else { } else {
slog.Debug("Watching directory:", slog.String("path", path)) slog.Debug("Watching directory:", slog.String("path", path))
} }