Commit fd0f800
Fix panic when printing a nil Date (#419)
* fix: fix panic when printing the nil Date
Not sure why, but this is only happening when running with delve.
It seems like printing a nil Stringer causes a panic when debugging
with delve but is handled gracefully outside of delve.
Steps to reproduce:
1. Start debugger
2. Print the value of a nil Date
```go
var d *Date
fmt.Sprintf("%v", d)
```
Theory:
`time.Time` is embedded within the `Date` type. This means that if
Date is nil and Stringer is used to get the string representation of
it, it'll try to call Date.Time.String() which will result in a nil
dereferencing error.
* Regenerate code
Co-authored-by: Beng Lim <beng.lim@outlook.com>1 parent 7884c50 commit fd0f800
2 files changed
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments