mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-08-28 04:46:30 -04:00
Address staticcheck warnings
This commit is contained in:
+2
-15
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
//go:build stxGo
|
||||
|
||||
package syntax
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user