backslashEscape, on windows, changes all the slash separated paths (which match unixPathPattern, to omit the prefix handler paths) with escaped backslashes.
(b []byte)
| 154 | // match unixPathPattern, to omit the prefix handler paths) with escaped |
| 155 | // backslashes. |
| 156 | func backslashEscape(b []byte) []byte { |
| 157 | if runtime.GOOS != "windows" { |
| 158 | return b |
| 159 | } |
| 160 | unixPaths := unixPathPattern.FindAll(b, -1) |
| 161 | if unixPaths == nil { |
| 162 | return b |
| 163 | } |
| 164 | var oldNew []string |
| 165 | for _, v := range unixPaths { |
| 166 | bStr := string(v) |
| 167 | oldNew = append(oldNew, bStr, strings.Replace(bStr, `/`, `\\`, -1)) |
| 168 | } |
| 169 | r := strings.NewReplacer(oldNew...) |
| 170 | return []byte(r.Replace(string(b))) |
| 171 | } |
| 172 | |
| 173 | func testConfig(name string, t *testing.T) { |
| 174 | wantedError := func() error { |
no outgoing calls
no test coverage detected