(t *testing.T, contents string)
| 64 | } |
| 65 | |
| 66 | func createTempConfig(t *testing.T, contents string) (string, func()) { |
| 67 | t.Helper() |
| 68 | configFile, err := os.CreateTemp("", "config") |
| 69 | if err != nil { |
| 70 | t.Fatal(err, "failed to create temp config file") |
| 71 | } |
| 72 | err = os.WriteFile(configFile.Name(), []byte(contents), 0644) |
| 73 | if err != nil { |
| 74 | os.Remove(configFile.Name()) |
| 75 | t.Fatal(err, "failed to write contents to temp config file") |
| 76 | } |
| 77 | return configFile.Name(), func() { os.Remove(configFile.Name()) } |
| 78 | } |
no test coverage detected