Commit 8573635

Eric Bower  ·  2025-08-10 08:58:43 -0400 EDT
parent c5d5ea8
chore: fix linter warnings
1 files changed,  +14, -12
+14, -12
......@@ -215,7 +215,7 @@ type WriteData struct {
215215 Template string
216216 Filename string
217217 Subdir string
218- Data interface{}
218+ Data any
219219 }
220220
221221 func bail(err error) {
......@@ -225,17 +225,18 @@ func bail(err error) {
225225 }
226226
227227 func diffFileType(_type git.DiffFileType) string {
228- if _type == git.DiffFileAdd {
228+ switch _type {
229+ case git.DiffFileAdd:
229230 return "A"
230- } else if _type == git.DiffFileChange {
231+ case git.DiffFileChange:
231232 return "M"
232- } else if _type == git.DiffFileDelete {
233+ case git.DiffFileDelete:
233234 return "D"
234- } else if _type == git.DiffFileRename {
235+ case git.DiffFileRename:
235236 return "R"
237+ default:
238+ return ""
236239 }
237-
238- return ""
239240 }
240241
241242 // converts contents of files in git tree to pretty formatted code.
......@@ -822,7 +823,8 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [
822823 }
823824
824825 fpath := tw.Config.getFileURL(tw.PageData.RevData, fmt.Sprintf("%s.html", fname))
825- if typ == git.ObjectTree {
826+ switch typ {
827+ case git.ObjectTree:
826828 item.IsDir = true
827829 fpath = tw.Config.compileURL(
828830 filepath.Join(
......@@ -832,7 +834,7 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [
832834 ),
833835 "index.html",
834836 )
835- } else if typ == git.ObjectBlob {
837+ case git.ObjectBlob:
836838 item.Icon = filenameToDevIcon(item.Name)
837839 }
838840 item.URL = fpath
......@@ -850,13 +852,14 @@ func (tw *TreeWalker) walk(tree *git.Tree, curpath string) {
850852 typ := entry.Type()
851853 item := tw.NewTreeItem(entry, curpath, crumbs)
852854
853- if typ == git.ObjectTree {
855+ switch typ {
856+ case git.ObjectTree:
854857 item.IsDir = true
855858 re, _ := tree.Subtree(entry.Name())
856859 tw.walk(re, item.Path)
857860 treeEntries = append(treeEntries, item)
858861 tw.treeItem <- item
859- } else if typ == git.ObjectBlob {
862+ case git.ObjectBlob:
860863 treeEntries = append(treeEntries, item)
861864 tw.treeItem <- item
862865 }
......@@ -1119,7 +1122,6 @@ func main() {
11191122 bail(err)
11201123
11211124 styles := style(*theme)
1122- fmt.Println(styles)
11231125 err = os.WriteFile(filepath.Join(out, "vars.css"), []byte(styles), 0644)
11241126 if err != nil {
11251127 panic(err)