Fixes based on various linter suggestions

This commit is contained in:
Jesse Portnoy
2023-08-03 16:13:18 +01:00
parent 6ae8b2f82e
commit 524a51e3ce
13 changed files with 128 additions and 37 deletions
+6 -7
View File
@@ -7,14 +7,14 @@ import (
"testing"
)
func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string) *Def {
func getDefs(t *testing.T, filename string, data []byte, highlightLexer string) *Def {
var def *Def
syn_dir := "./syntax_files"
synDir := "./syntax_files"
var defs []*Def
lerr, warnings := ParseSyntaxFiles(syn_dir, &defs)
warnings, lerr := ParseSyntaxFiles(synDir, &defs)
if lerr != nil {
t.Errorf("Couldn't get defs from '%s', error: %v\n", syn_dir, lerr)
t.Errorf("Couldn't get defs from '%s', error: %v\n", synDir, lerr)
}
if len(warnings) > 0 {
t.Errorf("Parsing ended with warnings: '%s'\n", strings.Join(warnings, ";"))
@@ -28,8 +28,8 @@ func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string)
}
// if a specific lexer was requested by setting the ENV var, try to load it
if highlight_lexer != "" {
syntaxFile, lerr := ioutil.ReadFile(syn_dir + "/" + highlight_lexer + ".yaml")
if highlightLexer != "" {
syntaxFile, lerr := ioutil.ReadFile(synDir + "/" + highlightLexer + ".yaml")
if lerr == nil {
// Parse it into a `*highlight.Def`
def, _ = ParseDef(syntaxFile)
@@ -40,6 +40,5 @@ func getDefs(t *testing.T, filename string, data []byte, highlight_lexer string)
t.Errorf("Found no defs for '%s'\n", filename)
}
//fmt.Println(def)
return def
}