Skip to content

Commit

Permalink
Call gofmt in test
Browse files Browse the repository at this point in the history
  • Loading branch information
jessp01 committed Jul 19, 2023
1 parent a861c28 commit a4539ec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: go build -v
- name: Test
run: |
FMT_ISSUES=$(gofmt -l .)
if test -n "$FMT_ISSUES" ;then printf "gofmt found problems:\n$FMT_ISSUES\n";exit 11; fi
sudo apt update && sudo apt install wget
mkdir /tmp/syntax_files && wget https://github.com/jessp01/gohighlight/raw/master/syntax_files/c.yaml -P /tmp/syntax_files
echo -e "#include <stdio.h>\nint main(int argc, char *argv[])" | ./zaje -s /tmp/syntax_files
Expand Down
35 changes: 17 additions & 18 deletions zaje.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func getDefs(filename string, data []byte) []highlight.LineMatch {
return h.HighlightString(string(data))
}


func colourOutput(matches []highlight.LineMatch, data []byte) {
lines := strings.Split(string(data), "\n")
for lineN, l := range lines {
Expand Down Expand Up @@ -228,23 +227,23 @@ COPYRIGHT:
} else {
// if progressive (i.e `tail -f` or ping)
if c.Args().Get(0) == "-" {
scanner := bufio.NewScanner(os.Stdin)

for scanner.Scan() {
data := scanner.Text()
handleData(filename, []byte(data))
}

if err := scanner.Err(); err != nil {
return err
}
// read everything and process
}else{
data, err := io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}
handleData(filename, []byte(data))
scanner := bufio.NewScanner(os.Stdin)

for scanner.Scan() {
data := scanner.Text()
handleData(filename, []byte(data))
}

if err := scanner.Err(); err != nil {
return err
}
// read everything and process
} else {
data, err := io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}
handleData(filename, []byte(data))
}
}
return nil
Expand Down

0 comments on commit a4539ec

Please sign in to comment.