Skip to content

Commit 68a3d58

Browse files
committed
*: support compilation under js/wasm
1 parent 3d7f61f commit 68a3d58

File tree

6 files changed

+43
-4
lines changed

6 files changed

+43
-4
lines changed

.github/workflows/test_js.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
on: [push, pull_request]
2+
name: Test
3+
jobs:
4+
test:
5+
strategy:
6+
matrix:
7+
go-version: [1.14.x, 1.15.x, 1.16.x]
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Install Go
11+
uses: actions/setup-go@v1
12+
with:
13+
go-version: ${{ matrix.go-version }}
14+
15+
- name: Install wasmbrowsertest
16+
run: |
17+
go get github.com/agnivade/wasmbrowsertest
18+
mv ~/go/bin/wasmbrowsertest ~/go/bin/go_js_wasm_exec
19+
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Test
24+
run: go test -exec="$HOME/go/bin/go_js_wasm_exec" ./...
25+
env:
26+
GOOS: js
27+
GOARCH: wasm

go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
2-
github.com/go-git/go-billy v1.0.0 h1:bXR6Zu3opPSg0R4dDxqaLglY4rxw7ja7wS16qSpOKL4=
3-
github.com/go-git/go-billy v3.1.0+incompatible h1:dwrJ8G2Jt1srYgIJs+lRjA36qBY68O2Lg5idKG8ef5M=
42
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
5-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
63
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
74
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
85
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=

osfs/os.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build !js
2+
13
// Package osfs provides a billy filesystem for the OS.
24
package osfs // import "github.com/go-git/go-billy/v5/osfs"
35

osfs/os_posix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !plan9,!windows
1+
// +build !plan9,!windows,!js
22

33
package osfs
44

osfs/os_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build !js
2+
13
package osfs
24

35
import (

osfs/os_unsupported.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// +build js
2+
3+
package osfs
4+
5+
import (
6+
"github.com/go-git/go-billy/v5"
7+
)
8+
9+
func New(string) billy.Filesystem {
10+
panic("unsupported arch or os")
11+
}

0 commit comments

Comments
 (0)