Skip to content

Commit 8d6640a

Browse files
authored
Merge pull request #88 from netlify/fix_rune_conversion
Fix run conversion on Windows.
2 parents feae114 + 92d3164 commit 8d6640a

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

appveyor.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: "{build}"
2+
3+
# Source Config
4+
5+
clone_folder: c:\gopath\src\github.com\netlify\open-api
6+
7+
# Build host
8+
9+
environment:
10+
GOPATH: c:\gopath
11+
DEPTESTBYPASS501: 1
12+
GOVERSION: 1.10
13+
14+
init:
15+
- git config --global core.autocrlf input
16+
17+
# Build
18+
19+
install:
20+
# Install the specific Go version.
21+
- rmdir c:\go /s /q
22+
- appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.msi
23+
- msiexec /i go%GOVERSION%.windows-amd64.msi /q
24+
- set Path=c:\go\bin;c:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial\%Path%
25+
- go version
26+
- go env
27+
- go get -u github.com/golang/dep/cmd/dep
28+
- ps: cd go
29+
- dep ensure
30+
31+
build: false
32+
deploy: false
33+
34+
test_script:
35+
- go test -v github.com/netlify/open-api/...

go/porcelain/deploy_unix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// +build !windows
2+
23
package porcelain
34

45
func forceSlashSeparators(name string) string {

go/porcelain/deploy_windows.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package porcelain
22

33
import (
4+
"fmt"
45
"os"
56
"strings"
67
)
78

89
func forceSlashSeparators(name string) string {
9-
return strings.Replace(name, os.PathSeparator, "/", -1)
10+
return strings.Replace(name, fmt.Sprintf("%c", os.PathSeparator), "/", -1)
1011
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package porcelain
2+
3+
import "testing"
4+
5+
func TestForceSlashSeparators(t *testing.T) {
6+
out := forceSlashSeparators("foo\\bar\\baz.js")
7+
if out != "foo/bar/baz.js" {
8+
t.Fatalf("expected `foo/bar/baz.js`, got `%s`", out)
9+
}
10+
}

0 commit comments

Comments
 (0)