getUpdateState reads the update state file if available.
()
| 69 | |
| 70 | // getUpdateState reads the update state file if available. |
| 71 | func (c *App) getUpdateState() (*updateState, error) { |
| 72 | f, err := os.Open(c.updateStateFilename()) |
| 73 | if err != nil { |
| 74 | return nil, errors.Wrap(err, "unable to open update state file") |
| 75 | } |
| 76 | defer f.Close() //nolint:errcheck |
| 77 | |
| 78 | us := &updateState{} |
| 79 | if err := json.NewDecoder(f).Decode(us); err != nil { |
| 80 | return nil, errors.Wrap(err, "unable to parse update state") |
| 81 | } |
| 82 | |
| 83 | return us, nil |
| 84 | } |
| 85 | |
| 86 | // maybeInitializeUpdateCheck optionally writes update state file with initial update |
| 87 | // set 24 hours from now. |
no test coverage detected