Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (33 sloc) 1000 Bytes
package srcinfo
import (
// LineError is an error type that stores the line number at which an error
// occurred as well the full Line that cased the error and an error string.
type LineError struct {
LineNumber int // The line number at which the error occurred
Line string // The line that caused the error
ErrorStr string // An error string
// Error Returns an error string in the format:
// "Line <LineNumber>: <ErrorStr>: <Line>".
func (le LineError) Error() string {
return fmt.Sprintf("Line %d: %s: %s", le.LineNumber, le.ErrorStr, le.Line)
// Error Returns a new LineError
func Error(LineNumber int, Line string, ErrorStr string) *LineError {
return &LineError{
// Errorf Returns a new LineError using the same formatting rules as
// fmt.Printf.
func Errorf(LineNumber int, Line string, ErrorStr string, args ...interface{}) *LineError {
return &LineError{
fmt.Sprintf(ErrorStr, args...),