refactor: use a more modern writing style to simplify code (#3834)

Signed-off-by: deepdring <deepdrink@icloud.com>
This commit is contained in:
deepdring
2025-08-26 08:00:51 +08:00
committed by GitHub
parent 094b02da4c
commit b8057f28c6
24 changed files with 98 additions and 100 deletions

View File

@@ -28,7 +28,7 @@ func JoinRule(rule string) string {
return joined
}
func parseFile(text, filename string) (filetype, syntax, header string, rules []interface{}) {
func parseFile(text, filename string) (filetype, syntax, header string, rules []any) {
lines := strings.Split(text, "\n")
// Regex for parsing syntax statements
@@ -129,7 +129,7 @@ func parseFile(text, filename string) (filetype, syntax, header string, rules []
return
}
func generateFile(filetype, syntax, header string, rules []interface{}) string {
func generateFile(filetype, syntax, header string, rules []any) string {
output := ""
output += fmt.Sprintf("filetype: %s\n\n", filetype)