- commit
- 8573635
- parent
- c5d5ea8
- author
- Eric Bower
- date
- 2025-08-10 08:58:43 -0400 EDT
chore: fix linter warnings
1 files changed,
+14,
-12
M
main.go
M
main.go
+14,
-12
1@@ -215,7 +215,7 @@ type WriteData struct {
2 Template string
3 Filename string
4 Subdir string
5- Data interface{}
6+ Data any
7 }
8
9 func bail(err error) {
10@@ -225,17 +225,18 @@ func bail(err error) {
11 }
12
13 func diffFileType(_type git.DiffFileType) string {
14- if _type == git.DiffFileAdd {
15+ switch _type {
16+ case git.DiffFileAdd:
17 return "A"
18- } else if _type == git.DiffFileChange {
19+ case git.DiffFileChange:
20 return "M"
21- } else if _type == git.DiffFileDelete {
22+ case git.DiffFileDelete:
23 return "D"
24- } else if _type == git.DiffFileRename {
25+ case git.DiffFileRename:
26 return "R"
27+ default:
28+ return ""
29 }
30-
31- return ""
32 }
33
34 // converts contents of files in git tree to pretty formatted code.
35@@ -822,7 +823,8 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [
36 }
37
38 fpath := tw.Config.getFileURL(tw.PageData.RevData, fmt.Sprintf("%s.html", fname))
39- if typ == git.ObjectTree {
40+ switch typ {
41+ case git.ObjectTree:
42 item.IsDir = true
43 fpath = tw.Config.compileURL(
44 filepath.Join(
45@@ -832,7 +834,7 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [
46 ),
47 "index.html",
48 )
49- } else if typ == git.ObjectBlob {
50+ case git.ObjectBlob:
51 item.Icon = filenameToDevIcon(item.Name)
52 }
53 item.URL = fpath
54@@ -850,13 +852,14 @@ func (tw *TreeWalker) walk(tree *git.Tree, curpath string) {
55 typ := entry.Type()
56 item := tw.NewTreeItem(entry, curpath, crumbs)
57
58- if typ == git.ObjectTree {
59+ switch typ {
60+ case git.ObjectTree:
61 item.IsDir = true
62 re, _ := tree.Subtree(entry.Name())
63 tw.walk(re, item.Path)
64 treeEntries = append(treeEntries, item)
65 tw.treeItem <- item
66- } else if typ == git.ObjectBlob {
67+ case git.ObjectBlob:
68 treeEntries = append(treeEntries, item)
69 tw.treeItem <- item
70 }
71@@ -1119,7 +1122,6 @@ func main() {
72 bail(err)
73
74 styles := style(*theme)
75- fmt.Println(styles)
76 err = os.WriteFile(filepath.Join(out, "vars.css"), []byte(styles), 0644)
77 if err != nil {
78 panic(err)