type errorMsg … var Pos … var errorMsgs … var numErrors … var numSyntaxErrors … // Errors returns the number of errors reported. func Errors() int { … } // SyntaxErrors returns the number of syntax errors reported. func SyntaxErrors() int { … } // addErrorMsg adds a new errorMsg (which may be a warning) to errorMsgs. func addErrorMsg(pos src.XPos, code errors.Code, format string, args ...interface{ … } // FmtPos formats pos as a file:line string. func FmtPos(pos src.XPos) string { … } type byPos … func (x byPos) Len() int { … } func (x byPos) Less(i, j int) bool { … } func (x byPos) Swap(i, j int) { … } // FlushErrors sorts errors seen so far by line number, prints them to stdout, // and empties the errors array. func FlushErrors() { … } var lasterror … // sameline reports whether two positions a, b are on the same line. func sameline(a, b src.XPos) bool { … } // Errorf reports a formatted error at the current line. func Errorf(format string, args ...interface{ … } // ErrorfAt reports a formatted error message at pos. func ErrorfAt(pos src.XPos, code errors.Code, format string, args ...interface{ … } // UpdateErrorDot is a clumsy hack that rewrites the last error, // if it was "LINE: undefined: NAME", to be "LINE: undefined: NAME in EXPR". // It is used to give better error messages for dot (selector) expressions. func UpdateErrorDot(line string, name, expr string) { … } // Warn reports a formatted warning at the current line. // In general the Go compiler does NOT generate warnings, // so this should be used only when the user has opted in // to additional output by setting a particular flag. func Warn(format string, args ...interface{ … } // WarnfAt reports a formatted warning at pos. // In general the Go compiler does NOT generate warnings, // so this should be used only when the user has opted in // to additional output by setting a particular flag. func WarnfAt(pos src.XPos, format string, args ...interface{ … } // Fatalf reports a fatal error - an internal problem - at the current line and exits. // If other errors have already been printed, then Fatalf just quietly exits. // (The internal problem may have been caused by incomplete information // after the already-reported errors, so best to let users fix those and // try again without being bothered about a spurious internal error.) // // But if no errors have been printed, or if -d panic has been specified, // Fatalf prints the error as an "internal compiler error". In a released build, // it prints an error asking to file a bug report. In development builds, it // prints a stack trace. // // If -h has been specified, Fatalf panics to force the usual runtime info dump. func Fatalf(format string, args ...interface{ … } var bugStack … // FatalfAt reports a fatal error - an internal problem - at pos and exits. // If other errors have already been printed, then FatalfAt just quietly exits. // (The internal problem may have been caused by incomplete information // after the already-reported errors, so best to let users fix those and // try again without being bothered about a spurious internal error.) // // But if no errors have been printed, or if -d panic has been specified, // FatalfAt prints the error as an "internal compiler error". In a released build, // it prints an error asking to file a bug report. In development builds, it // prints a stack trace. // // If -h has been specified, FatalfAt panics to force the usual runtime info dump. func FatalfAt(pos src.XPos, format string, args ...interface{ … } // Assert reports "assertion failed" with Fatalf, unless b is true. func Assert(b bool) { … } // Assertf reports a fatal error with Fatalf, unless b is true. func Assertf(b bool, format string, args ...interface{ … } // AssertfAt reports a fatal error with FatalfAt, unless b is true. func AssertfAt(b bool, pos src.XPos, format string, args ...interface{ … } // hcrash crashes the compiler when -h is set, to find out where a message is generated. func hcrash() { … } // ErrorExit handles an error-status exit. // It flushes any pending errors, removes the output file, and exits. func ErrorExit() { … } // ExitIfErrors calls ErrorExit if any errors have been reported. func ExitIfErrors() { … } var AutogeneratedPos …