substitute location in error output with acme addr
This commit is contained in:
parent
fc558d99f2
commit
e682ade2e9
10
uncrust.go
10
uncrust.go
@ -7,6 +7,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -17,6 +19,8 @@ import (
|
|||||||
var (
|
var (
|
||||||
fl_lang = flag.String("l", "C", "Language")
|
fl_lang = flag.String("l", "C", "Language")
|
||||||
fl_verbose = flag.Bool("v", false, "Verbosity on")
|
fl_verbose = flag.Bool("v", false, "Verbosity on")
|
||||||
|
|
||||||
|
pos_rx = regexp.MustCompile(`File: stdin, orig line is ([\d]+), orig col is ([\d])`)
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -54,7 +58,9 @@ func main() {
|
|||||||
if _, ok := e.(*exec.ExitError); ok {
|
if _, ok := e.(*exec.ExitError); ok {
|
||||||
str := stderr.String()
|
str := stderr.String()
|
||||||
if len(samfile) != 0 {
|
if len(samfile) != 0 {
|
||||||
|
samfile = "./" + filepath.Base(samfile)
|
||||||
str = strings.ReplaceAll(str, "stdin, open_line is ", samfile+":")
|
str = strings.ReplaceAll(str, "stdin, open_line is ", samfile+":")
|
||||||
|
str = pos_rx.ReplaceAllString(str, fmt.Sprintf("%s:$1:#$2", samfile))
|
||||||
}
|
}
|
||||||
log.Fatal("error: " + str)
|
log.Fatal("error: " + str)
|
||||||
}
|
}
|
||||||
@ -87,11 +93,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(edits) > 0 {
|
if len(edits) > 0 {
|
||||||
win.Write("ctl", []byte("mark"))
|
|
||||||
win.Write("ctl", []byte("nomark"))
|
|
||||||
if *fl_verbose {
|
if *fl_verbose {
|
||||||
log.Printf("Applying %d diffs:\n%s\n", len(edits), pretty(edits, samfile))
|
log.Printf("Applying %d diffs:\n%s\n", len(edits), pretty(edits, samfile))
|
||||||
}
|
}
|
||||||
|
win.Write("ctl", []byte("mark"))
|
||||||
|
win.Write("ctl", []byte("nomark"))
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := len(edits) - 1; i >= 0; i-- {
|
for i := len(edits) - 1; i >= 0; i-- {
|
||||||
|
Loading…
Reference in New Issue
Block a user