Skip to content

Commit

Permalink
main: stops panicing error
Browse files Browse the repository at this point in the history
    fixes #43
  • Loading branch information
arthur committed Aug 8, 2017
1 parent 92ddd50 commit 7d4d528
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions comparer/comparer.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ func readFile(file, path string) (map[string]string, error) {
}
tag = markers[0]
valEnd := strings.LastIndex(line, "<")
if valEnd < indexEnd {
continue
}
fmt.Println(indexEnd, valEnd, len(line))
translationValue := line[indexEnd+1 : valEnd]
if (indexStart != -1) && (indexEnd != -1) {
tags[tag] = translationValue
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"log"
"os"

"github.com/XML-Comp/XML-Comp/comparer"
Expand All @@ -19,6 +20,7 @@ func main() {
)
flag.Parse()
args := os.Args
// fmt.Println(len(args))
switch {
case len(args) < 2 || args[1] == "-h":
flag.Usage()
Expand All @@ -35,7 +37,7 @@ func main() {
comparer.DocType = *docType
err := comparer.Compare(*original, *translation)
if err != nil {
panic(err)
log.Fatal(err)
}
fmt.Println("Docs comparisons are DONE!")
fmt.Printf("Documents scanned: %v | Lines scanned: %v | Translations needed: %v\n", comparer.Docs, comparer.Lines, comparer.InNeed)
Expand Down

0 comments on commit 7d4d528

Please sign in to comment.