(t *testing.T, name, newValue string)
| 143 | } |
| 144 | |
| 145 | func setenv(t *testing.T, name, newValue string) { |
| 146 | oldValue, hasOldValue := os.LookupEnv(name) |
| 147 | if err := os.Setenv(name, newValue); err != nil { |
| 148 | t.Errorf("error setting environment variable %s: %v", name, err) |
| 149 | } |
| 150 | t.Cleanup(func() { |
| 151 | if hasOldValue { |
| 152 | _ = os.Setenv(name, oldValue) |
| 153 | } else { |
| 154 | _ = os.Unsetenv(name) |
| 155 | } |
| 156 | }) |
| 157 | } |
| 158 | |
| 159 | func winonly(s string) string { |
| 160 | if runtime.GOOS == "windows" { |
no outgoing calls
no test coverage detected
searching dependent graphs…