diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-06-15 12:29:11 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-07-05 11:29:44 +0000 |
| commit | 1c8e48305a43b3ebe84d2c046ba1da31d70284a8 (patch) | |
| tree | 63026d37571eed6200b78191ddf65131e24e1743 /pkg | |
| parent | 29396b656bc85f2ce721ae032f607afcf67d84d4 (diff) | |
pkg/report: refactor Type
Make it string -- it will be easier and cause less code duplication.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/report/report.go | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/pkg/report/report.go b/pkg/report/report.go index ca0fe575c..ebbcd894c 100644 --- a/pkg/report/report.go +++ b/pkg/report/report.go @@ -75,31 +75,18 @@ func (r Report) String() string { return fmt.Sprintf("crash: %v\n%s", r.Title, r.Report) } -type Type int +type Type string const ( - Unknown Type = iota - Hang - MemoryLeak - DataRace - UnexpectedReboot + Unknown = Type("") + Hang = Type("HANG") + MemoryLeak = Type("LEAK") + DataRace = Type("DATARACE") + UnexpectedReboot = Type("REBOOT") ) func (t Type) String() string { - switch t { - case Unknown: - return "UNKNOWN" - case Hang: - return "HANG" - case MemoryLeak: - return "LEAK" - case DataRace: - return "DATARACE" - case UnexpectedReboot: - return "REBOOT" - default: - panic("unknown report type") - } + return string(t) } // NewReporter creates reporter for the specified OS/Type. |
