Commit 8573635
Eric Bower
·
2025-08-10 08:58:43 -0400 EDT
parent c5d5ea8
chore: fix linter warnings
1 files changed,
+14,
-12
M
main.go
M
main.go
+14,
-12
| ... | ... | @@ -215,7 +215,7 @@ type WriteData struct { | |
| 215 | 215 | Template string | |
| 216 | 216 | Filename string | |
| 217 | 217 | Subdir string | |
| 218 | - | Data interface{} | |
| 218 | + | Data any | |
| 219 | 219 | } | |
| 220 | 220 | ||
| 221 | 221 | func bail(err error) { |
| ... | ... | @@ -225,17 +225,18 @@ func bail(err error) { | |
| 225 | 225 | } | |
| 226 | 226 | ||
| 227 | 227 | func diffFileType(_type git.DiffFileType) string { | |
| 228 | - | if _type == git.DiffFileAdd { | |
| 228 | + | switch _type { | |
| 229 | + | case git.DiffFileAdd: | |
| 229 | 230 | return "A" | |
| 230 | - | } else if _type == git.DiffFileChange { | |
| 231 | + | case git.DiffFileChange: | |
| 231 | 232 | return "M" | |
| 232 | - | } else if _type == git.DiffFileDelete { | |
| 233 | + | case git.DiffFileDelete: | |
| 233 | 234 | return "D" | |
| 234 | - | } else if _type == git.DiffFileRename { | |
| 235 | + | case git.DiffFileRename: | |
| 235 | 236 | return "R" | |
| 237 | + | default: | |
| 238 | + | return "" | |
| 236 | 239 | } | |
| 237 | - | ||
| 238 | - | return "" | |
| 239 | 240 | } | |
| 240 | 241 | ||
| 241 | 242 | // 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 [ | |
| 822 | 823 | } | |
| 823 | 824 | ||
| 824 | 825 | fpath := tw.Config.getFileURL(tw.PageData.RevData, fmt.Sprintf("%s.html", fname)) | |
| 825 | - | if typ == git.ObjectTree { | |
| 826 | + | switch typ { | |
| 827 | + | case git.ObjectTree: | |
| 826 | 828 | item.IsDir = true | |
| 827 | 829 | fpath = tw.Config.compileURL( | |
| 828 | 830 | filepath.Join( |
| ... | ... | @@ -832,7 +834,7 @@ func (tw *TreeWalker) NewTreeItem(entry *git.TreeEntry, curpath string, crumbs [ | |
| 832 | 834 | ), | |
| 833 | 835 | "index.html", | |
| 834 | 836 | ) | |
| 835 | - | } else if typ == git.ObjectBlob { | |
| 837 | + | case git.ObjectBlob: | |
| 836 | 838 | item.Icon = filenameToDevIcon(item.Name) | |
| 837 | 839 | } | |
| 838 | 840 | item.URL = fpath |
| ... | ... | @@ -850,13 +852,14 @@ func (tw *TreeWalker) walk(tree *git.Tree, curpath string) { | |
| 850 | 852 | typ := entry.Type() | |
| 851 | 853 | item := tw.NewTreeItem(entry, curpath, crumbs) | |
| 852 | 854 | ||
| 853 | - | if typ == git.ObjectTree { | |
| 855 | + | switch typ { | |
| 856 | + | case git.ObjectTree: | |
| 854 | 857 | item.IsDir = true | |
| 855 | 858 | re, _ := tree.Subtree(entry.Name()) | |
| 856 | 859 | tw.walk(re, item.Path) | |
| 857 | 860 | treeEntries = append(treeEntries, item) | |
| 858 | 861 | tw.treeItem <- item | |
| 859 | - | } else if typ == git.ObjectBlob { | |
| 862 | + | case git.ObjectBlob: | |
| 860 | 863 | treeEntries = append(treeEntries, item) | |
| 861 | 864 | tw.treeItem <- item | |
| 862 | 865 | } |