Skip to content

Commit

Permalink
ImportError: fix method Error
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Nov 21, 2023
1 parent 33c37b7 commit de715e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions import.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ func (p *ImportError) Unwrap() error {
}

func (p *ImportError) Error() string {
if p.Fset == nil {
return fmt.Sprintf("%v", p.Err)
}

Check warning on line 340 in import.go

View check run for this annotation

Codecov / codecov/patch

import.go#L339-L340

Added lines #L339 - L340 were not covered by tests
pos := p.Fset.Position(p.Pos)
return fmt.Sprintf("%v: %v", pos, p.Err)
}
Expand Down

0 comments on commit de715e2

Please sign in to comment.