From f5367779eb4bcaaca0640f1ce7316001e34f41d8 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sat, 14 Jun 2025 09:48:15 -0400 Subject: [PATCH] Address staticcheck warnings --- highlighter.go | 17 ++--------------- parser.go | 2 +- syntax/stxGo.go | 2 -- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/highlighter.go b/highlighter.go index e7e0b44..3123f96 100644 --- a/highlighter.go +++ b/highlighter.go @@ -1,7 +1,7 @@ package highlight import ( - "io/ioutil" + "os" "path/filepath" "regexp" "strings" @@ -20,19 +20,6 @@ func runePos(p int, str string) int { return utf8.RuneCountInString(str[:p]) } -func combineLineMatch(src, dst LineMatch) LineMatch { - for k, v := range src { - if g, ok := dst[k]; ok { - if g == 0 { - dst[k] = v - } - } else { - dst[k] = v - } - } - return dst -} - // A State represents the region at the end of a line type State *region @@ -72,7 +59,7 @@ func ParseSyntaxFiles(dir string, defs *[]*Def) ([]string, error) { } for _, filePath := range files { - file, err := ioutil.ReadFile(filePath) + file, err := os.ReadFile(filePath) if err != nil { warnings = append(warnings, filePath+": "+err.Error()) } else if len(file) > 0 { diff --git a/parser.go b/parser.go index 49b2e50..e829d70 100644 --- a/parser.go +++ b/parser.go @@ -197,7 +197,7 @@ func parseRules(input []interface{}, curRegion *region) (*rules, error) { } rules.regions = append(rules.regions, region) default: - return nil, fmt.Errorf("Bad type %T", object) + return nil, fmt.Errorf("bad type %T", object) } } } diff --git a/syntax/stxGo.go b/syntax/stxGo.go index a481eea..a7f25e9 100644 --- a/syntax/stxGo.go +++ b/syntax/stxGo.go @@ -1,5 +1,3 @@ -//go:build stxGo - package syntax func init() {