writeTestStateFile writes contents to either the file referenced by the environment variable envVar, or defaultFilename if that's not set. Returns the filename that was used
(contents []byte, envVar, defaultFilename string)
| 168 | // environment variable envVar, or defaultFilename if that's not set. Returns |
| 169 | // the filename that was used |
| 170 | func writeTestStateFile(contents []byte, envVar, defaultFilename string) string { |
| 171 | f := os.Getenv(envVar) |
| 172 | if len(f) == 0 { |
| 173 | f = defaultFilename |
| 174 | } |
| 175 | file, err := os.Create(f) |
| 176 | if err != nil { |
| 177 | log.Fatalln(err) |
| 178 | } |
| 179 | file.Write(contents) |
| 180 | file.Close() |
| 181 | return f |
| 182 | } |
| 183 | |
| 184 | type lfsObject struct { |
| 185 | Oid string `json:"oid,omitempty"` |