Address staticcheck warnings

This commit is contained in:
2025-06-14 09:48:15 -04:00
parent a427b4a907
commit f5367779eb
3 changed files with 3 additions and 18 deletions
+2 -15
View File
@@ -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 {
+1 -1
View File
@@ -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)
}
}
}
-2
View File
@@ -1,5 +1,3 @@
//go:build stxGo
package syntax
func init() {