mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-09-05 16:37:20 -04:00
Fixes based on various linter suggestions
This commit is contained in:
+6
-7
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user