newTracker returns a new initialized instance of Tracker. If path is "", an empty instance is returned.
(input []byte)
| 49 | // newTracker returns a new initialized instance of Tracker. If path |
| 50 | // is "", an empty instance is returned. |
| 51 | func newTracker(input []byte) (t Tracker, err error) { |
| 52 | if input != nil { |
| 53 | err = yaml.Unmarshal(input, &t) |
| 54 | if err != nil { |
| 55 | return |
| 56 | } |
| 57 | } else { |
| 58 | t = Tracker{} |
| 59 | } |
| 60 | |
| 61 | t.setDefaults() |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | // setDefaults initializes the required nested attributes. |
| 66 | func (t *Tracker) setDefaults() { |