MarshalJSON implements custom JSON marshaling to include both Filename and DisplayName
()
| 389 | |
| 390 | // MarshalJSON implements custom JSON marshaling to include both Filename and DisplayName |
| 391 | func (c Crontab) MarshalJSON() ([]byte, error) { |
| 392 | type Alias Crontab |
| 393 | timezone := "" |
| 394 | if c.TimezoneLocationName != nil { |
| 395 | timezone = c.TimezoneLocationName.Name |
| 396 | } |
| 397 | return json.Marshal(&struct { |
| 398 | Alias |
| 399 | DisplayName string `json:"display_name"` |
| 400 | Timezone string `json:"timezone,omitempty"` |
| 401 | Shell string `json:"shell,omitempty"` |
| 402 | Lines []*Line `json:"lines"` |
| 403 | }{ |
| 404 | Alias: Alias(c), |
| 405 | DisplayName: c.DisplayName(), |
| 406 | Timezone: timezone, |
| 407 | Shell: c.Shell, |
| 408 | Lines: c.Lines, |
| 409 | }) |
| 410 | } |
| 411 | |
| 412 | type Line struct { |
| 413 | IsComment bool |
nothing calls this directly
no test coverage detected