mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
go mod vendor
This commit is contained in:
14
vendor/github.com/go-errors/errors/stackframe.go
generated
vendored
14
vendor/github.com/go-errors/errors/stackframe.go
generated
vendored
@ -53,7 +53,7 @@ func (frame *StackFrame) Func() *runtime.Func {
|
||||
func (frame *StackFrame) String() string {
|
||||
str := fmt.Sprintf("%s:%d (0x%x)\n", frame.File, frame.LineNumber, frame.ProgramCounter)
|
||||
|
||||
source, err := frame.sourceLine()
|
||||
source, err := frame.SourceLine()
|
||||
if err != nil {
|
||||
return str
|
||||
}
|
||||
@ -63,21 +63,13 @@ func (frame *StackFrame) String() string {
|
||||
|
||||
// SourceLine gets the line of code (from File and Line) of the original source if possible.
|
||||
func (frame *StackFrame) SourceLine() (string, error) {
|
||||
source, err := frame.sourceLine()
|
||||
if err != nil {
|
||||
return source, New(err)
|
||||
}
|
||||
return source, err
|
||||
}
|
||||
|
||||
func (frame *StackFrame) sourceLine() (string, error) {
|
||||
if frame.LineNumber <= 0 {
|
||||
return "???", nil
|
||||
}
|
||||
|
||||
file, err := os.Open(frame.File)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", New(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
@ -90,7 +82,7 @@ func (frame *StackFrame) sourceLine() (string, error) {
|
||||
currentLine++
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return "", err
|
||||
return "", New(err)
|
||||
}
|
||||
|
||||
return "???", nil
|
||||
|
Reference in New Issue
Block a user