pj1/pj1-go/util/error.go

20 lines
278 B
Go

package util
import (
"fmt"
"os"
)
var (
HadError bool = false
)
func Error(line int, msg string) {
report(line, "", msg)
HadError = true
}
func report(line int, where string, msg string) {
fmt.Fprintln(os.Stderr, "[line "+fmt.Sprint(line)+"] Error"+where+": "+msg)
}