updatePath is where ghmock schemas update writes the file: the path in the environment variable if it's set, because that's the file ghmock uses, and the cache otherwise.
()
| 97 | // environment variable if it's set, because that's the file ghmock uses, and |
| 98 | // the cache otherwise. |
| 99 | func (s schemaSource) updatePath() (string, error) { |
| 100 | if p := os.Getenv(s.envVar); p != "" { |
| 101 | return p, nil |
| 102 | } |
| 103 | return s.cachePath() |
| 104 | } |
| 105 | |
| 106 | // download fetches the file to path. It checks the file and writes it to a |
| 107 | // temporary file first, so a failed download never replaces a good copy. |