From e3d12cf9cc4d49cf040eb1a74e3d9f830351062a Mon Sep 17 00:00:00 2001 From: Brian McGee Date: Thu, 17 Oct 2024 12:24:45 +0100 Subject: [PATCH] chore: remove unused code Signed-off-by: Brian McGee --- format/task.go | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 format/task.go diff --git a/format/task.go b/format/task.go deleted file mode 100644 index 922dc6db..00000000 --- a/format/task.go +++ /dev/null @@ -1,45 +0,0 @@ -package format - -import ( - "cmp" - "slices" - - "github.com/numtide/treefmt/walk" -) - -type Task struct { - File *walk.File - Formatters []*Formatter - BatchKey string - Errors []error -} - -func NewTask(file *walk.File, formatters []*Formatter) Task { - // sort by priority in ascending order - slices.SortFunc(formatters, func(a, b *Formatter) int { - priorityA := a.Priority() - priorityB := b.Priority() - - result := priorityA - priorityB - if result == 0 { - // formatters with the same priority are sorted lexicographically to ensure a deterministic outcome - result = cmp.Compare(a.Name(), b.Name()) - } - - return result - }) - - // construct a batch key which represents the unique sequence of formatters to be applied to file - var key string - for _, f := range formatters { - key += f.name + ":" - } - - key = key[:len(key)-1] - - return Task{ - File: file, - Formatters: formatters, - BatchKey: key, - } -}