Skip to content

Commit

Permalink
Merge pull request #4 from ydnar/ydnar/tinygo
Browse files Browse the repository at this point in the history
TinyGo support
  • Loading branch information
ydnar authored Oct 17, 2023
2 parents eca4966 + 4d854c7 commit 7fc6b15
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 28 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
go-version-file: go.mod
check-latest: true

- name: Set up TinyGo
uses: acifani/[email protected]
with:
tinygo-version: '0.30.0'

- name: Vet Go code
run: go vet ./...

Expand All @@ -34,5 +39,8 @@ jobs:
CGO_ENABLED: 0
run: go test -v ./...

- name: Test with TinyGo
run: tinygo test -v ./...

- name: Verify repo is unchanged
run: git diff --exit-code HEAD
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ require (
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
)

Expand Down
10 changes: 8 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dkegel-fastly/go-isatty v0.0.0-20230520140422-13f35908f730 h1:BwvW8VJvemd/fNVo3JAyHEAKkNxhDRxS/+puOcutQLU=
github.com/dkegel-fastly/go-isatty v0.0.0-20230520140422-13f35908f730/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs=
github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand All @@ -35,6 +39,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
46 changes: 23 additions & 23 deletions wit/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ func (c *worldItemCodec) DecodeField(dec codec.Decoder, name string) error {
switch name {
case "interface":
var v *Interface
*c.v, err = v, dec.Decode(&v)
err, *c.v = dec.Decode(&v), v
case "function":
var v *Function
*c.v, err = v, dec.Decode(&v)
err, *c.v = dec.Decode(&v), v
case "type":
var v *TypeDef
*c.v, err = v, dec.Decode(&v)
err, *c.v = dec.Decode(&v), v
}
return err
}
Expand Down Expand Up @@ -248,10 +248,10 @@ func (c *typeOwnerCodec) DecodeField(dec codec.Decoder, name string) error {
switch name {
case "interface":
var v *Interface
*c.v, err = v, dec.Decode(&v)
err, *c.v = dec.Decode(&v), v
case "world":
var v *World
*c.v, err = v, dec.Decode(&v)
err, *c.v = dec.Decode(&v), v
}
return err
}
Expand All @@ -274,43 +274,43 @@ func (c *typeDefKindCodec) DecodeField(dec codec.Decoder, name string) error {
switch name {
case "record":
v := &Record{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "resource": // TODO: this might not be necessary
v := &Resource{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "handle":
var v Handle
*c.v, err = v, dec.Decode(&v)
err, *c.v = dec.Decode(&v), v
case "flags":
v := &Flags{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "tuple":
v := &Tuple{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "variant":
v := &Variant{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "enum":
v := &Enum{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "option":
v := &Option{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
case "result":
v := &Result{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "list":
v := &List{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
case "future":
v := &Future{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
case "stream":
v := &Stream{}
*c.v, err = v, dec.Decode(v)
err, *c.v = dec.Decode(v), v
case "type":
var v Type
*c.v, err = v, dec.Decode(&v)
err, *c.v = dec.Decode(&v), v
}
return err
}
Expand Down Expand Up @@ -404,10 +404,10 @@ func (c *handleCodec) DecodeField(dec codec.Decoder, name string) error {
switch name {
case "own":
v := &OwnedHandle{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
case "borrow":
v := &BorrowedHandle{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
}
return err
}
Expand Down Expand Up @@ -493,13 +493,13 @@ func (c *functionKindCodec) DecodeField(dec codec.Decoder, name string) error {
switch name {
case "method":
v := &Method{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
case "static":
v := &Static{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
case "constructor":
v := &Constructor{}
*c.v, err = v, dec.Decode(&v.Type)
err, *c.v = dec.Decode(&v.Type), v
}
return err
}
Expand Down

0 comments on commit 7fc6b15

Please sign in to comment.