From 9ba05d26ee2382f3191e25ae7af5d462ba2a35e4 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Sun, 18 Jun 2023 17:02:07 +0200 Subject: fix: Fix linter issues --- cmd/server/main.go | 6 +++--- pkg/ext/gorm_logger.go | 4 ++-- pkg/fileop/exif.go | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index 375a26c..59ea957 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -90,14 +90,14 @@ func main() { exifScanner = worker.NewEXIFScanner(root, mediaRepository) ) - ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) - defer stop() - pool := worker.NewWorkerPool() pool.AddWorker("http server", serverWorker) pool.AddWorker("exif scanner", worker.NewWorkerFromListProcessor[*media.Media](exifScanner, scheduler)) pool.AddWorker("file scanner", worker.NewWorkerFromChanProcessor[string](fileScanner, scheduler)) + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) + defer stop() + pool.Start(ctx) pool.Wait() } diff --git a/pkg/ext/gorm_logger.go b/pkg/ext/gorm_logger.go index bfb26d2..bfbbb1e 100644 --- a/pkg/ext/gorm_logger.go +++ b/pkg/ext/gorm_logger.go @@ -18,7 +18,7 @@ func getFullMsg(msg string, data ...interface{}) string { return fmt.Sprintf(msg, append([]interface{}{utils.FileWithLineNum()}, data...)...) } -func (self *Log) LogMode(log logger.LogLevel) logger.Interface { +func (self *Log) LogMode(_ logger.LogLevel) logger.Interface { return self } @@ -42,7 +42,7 @@ func (self *Log) Error(ctx context.Context, msg string, data ...interface{}) { Error(fullMsg) } -func (self *Log) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) { +func (self *Log) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), _ error) { elapsed := time.Since(begin) sql, _ := fc() self.logrus. diff --git a/pkg/fileop/exif.go b/pkg/fileop/exif.go index 48e495c..c2449ad 100644 --- a/pkg/fileop/exif.go +++ b/pkg/fileop/exif.go @@ -4,8 +4,9 @@ import ( "math" "time" - "git.sr.ht/~gabrielgio/img/pkg/components/media" "github.com/barasher/go-exiftool" + + "git.sr.ht/~gabrielgio/img/pkg/components/media" ) func ReadExif(path string) (*media.MediaEXIF, error) { -- cgit v1.2.3