mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-09-05 16:37:20 -04:00
Address staticcheck warnings
This commit is contained in:
+2
-15
@@ -1,7 +1,7 @@
|
|||||||
package highlight
|
package highlight
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -20,19 +20,6 @@ func runePos(p int, str string) int {
|
|||||||
return utf8.RuneCountInString(str[:p])
|
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
|
// A State represents the region at the end of a line
|
||||||
type State *region
|
type State *region
|
||||||
|
|
||||||
@@ -72,7 +59,7 @@ func ParseSyntaxFiles(dir string, defs *[]*Def) ([]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, filePath := range files {
|
for _, filePath := range files {
|
||||||
file, err := ioutil.ReadFile(filePath)
|
file, err := os.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
warnings = append(warnings, filePath+": "+err.Error())
|
warnings = append(warnings, filePath+": "+err.Error())
|
||||||
} else if len(file) > 0 {
|
} else if len(file) > 0 {
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ func parseRules(input []interface{}, curRegion *region) (*rules, error) {
|
|||||||
}
|
}
|
||||||
rules.regions = append(rules.regions, region)
|
rules.regions = append(rules.regions, region)
|
||||||
default:
|
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
|
package syntax
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user