mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-09-06 00:47:15 -04:00
following gofmt -s
This commit is contained in:
+3
-3
@@ -4,9 +4,9 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"log"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/jessp01/highlight"
|
||||
@@ -23,13 +23,13 @@ func main() {
|
||||
var syn_dir string
|
||||
if gopath == "" {
|
||||
syn_dir = "/etc/highlight"
|
||||
}else{
|
||||
} else {
|
||||
syn_dir = gopath + "/src/github.com/jessp01/highlight/syntax_files"
|
||||
}
|
||||
|
||||
syn_dir = os.Getenv("SYNDIR")
|
||||
var defs []*highlight.Def
|
||||
err := highlight.ParseSyntaxFiles (syn_dir, &defs)
|
||||
err := highlight.ParseSyntaxFiles(syn_dir, &defs)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
+4
-5
@@ -1,11 +1,11 @@
|
||||
package highlight
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
"path/filepath"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
// RunePos returns the rune index of a given byte index
|
||||
@@ -62,14 +62,14 @@ func NewHighlighter(def *Def) *Highlighter {
|
||||
// color's group (represented as one byte)
|
||||
type LineMatch map[int]Group
|
||||
|
||||
func ParseSyntaxFiles (dir string, defs *[]*Def) error{
|
||||
func ParseSyntaxFiles(dir string, defs *[]*Def) error {
|
||||
pattern := "*.yaml"
|
||||
files, err := filepath.Glob(dir + "/" + pattern)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, file_path := range(files){
|
||||
for _, file_path := range files {
|
||||
file, err := ioutil.ReadFile(file_path)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -228,7 +228,6 @@ func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canM
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
if len(line) == 0 {
|
||||
if canMatchEnd {
|
||||
h.lastRegion = nil
|
||||
|
||||
Reference in New Issue
Block a user