chore: prepare Go 1.21/Tinygo 0.28
This commit is contained in:
parent
cc52d19501
commit
3bf4797b6a
13 changed files with 62 additions and 985 deletions
|
@ -1,3 +1,5 @@
|
|||
buildr {
|
||||
|
||||
bin_dir = ".buildr/bin"
|
||||
out_dir = ".buildr/out"
|
||||
logs_dir = ".buildr/logs"
|
||||
}
|
|
@ -3,7 +3,7 @@ task "script" "buf_generate" {
|
|||
"buf generate --debug"
|
||||
]
|
||||
|
||||
out_dir = buildr.repo.root
|
||||
out_dir = repo.root
|
||||
|
||||
input_mapping = {
|
||||
"api" = "api",
|
||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -19,4 +19,6 @@
|
|||
# vendor/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
go.work*
|
||||
|
||||
.idea/
|
2
api.go
2
api.go
|
@ -3,7 +3,6 @@ package sdk
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/mailru/easyjson"
|
||||
"golang.org/x/exp/slog"
|
||||
"io"
|
||||
"time"
|
||||
|
@ -44,7 +43,6 @@ type ExecutionContext interface {
|
|||
}
|
||||
|
||||
type Module interface {
|
||||
easyjson.Unmarshaler
|
||||
Execute(ctx ExecutionContext) error
|
||||
Category() Category
|
||||
Type() string
|
||||
|
|
|
@ -2,8 +2,8 @@ package sdk
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/mailru/easyjson"
|
||||
_ "github.com/tetratelabs/tinymem"
|
||||
|
||||
"code.icb4dc0.de/buildr/wasi-module-sdk-go/mem"
|
||||
|
@ -16,7 +16,7 @@ func Register(cat Category, moduleName string, factory Factory) {
|
|||
defaultRegistry.Add(cat, moduleName, factory)
|
||||
}
|
||||
|
||||
//export inventory
|
||||
//go:wasmimport inventory
|
||||
func Inventory() uint64 {
|
||||
var inventory rpcv1.PluginInventory
|
||||
|
||||
|
@ -35,7 +35,7 @@ func Inventory() uint64 {
|
|||
return mem.UnifyPtrSize(mem.DataToUnmanagedPtr(data))
|
||||
}
|
||||
|
||||
//export run
|
||||
//go:wasmimport run
|
||||
func Run(specPtr, specSize uint32) {
|
||||
var startTask rpcv1.StartTaskRequest
|
||||
|
||||
|
@ -47,7 +47,7 @@ func Run(specPtr, specSize uint32) {
|
|||
reference := startTask.GetReference().GetModule()
|
||||
module := defaultRegistry.Get(Category(reference.GetModuleCategory()), reference.GetModuleType())
|
||||
|
||||
if err := easyjson.Unmarshal(startTask.RawTask, module); err != nil {
|
||||
if err := json.Unmarshal(startTask.RawTask, module); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ go 1.20
|
|||
require (
|
||||
code.icb4dc0.de/buildr/buildr v0.0.0-00010101000000-000000000000
|
||||
code.icb4dc0.de/buildr/wasi-module-sdk-go v0.0.0-20230513154609-25ec63d3507d
|
||||
github.com/mailru/easyjson v0.7.7
|
||||
github.com/stretchr/testify v1.8.2
|
||||
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
|
||||
github.com/stretchr/testify v1.8.4
|
||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
|
||||
)
|
||||
|
||||
replace (
|
||||
|
@ -16,70 +15,40 @@ replace (
|
|||
)
|
||||
|
||||
require (
|
||||
ariga.io/atlas v0.10.2-0.20230427182402-87a07dfb83bf // indirect
|
||||
cloud.google.com/go v0.110.0 // indirect
|
||||
cloud.google.com/go/compute v1.19.0 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.2.3 // indirect
|
||||
cloud.google.com/go/iam v0.13.0 // indirect
|
||||
cloud.google.com/go/storage v1.28.1 // indirect
|
||||
ariga.io/atlas v0.12.0 // indirect
|
||||
entgo.io/ent v0.12.3 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.122 // indirect
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/docker/docker v23.0.5+incompatible // indirect
|
||||
github.com/docker/docker v24.0.2+incompatible // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/go-openapi/inflect v0.19.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-getter v1.7.1 // indirect
|
||||
github.com/hashicorp/go-safetemp v1.0.0 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.16.2 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/hashicorp/hcl/v2 v2.17.0 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/klauspost/compress v1.16.5 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/tetratelabs/tinymem v0.1.0 // indirect
|
||||
github.com/tetratelabs/wazero v1.1.0 // indirect
|
||||
github.com/ulikunitz/xz v0.5.10 // indirect
|
||||
github.com/zclconf/go-cty v1.13.1 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
github.com/zclconf/go-cty v1.13.2 // indirect
|
||||
golang.org/x/mod v0.10.0 // indirect
|
||||
golang.org/x/net v0.9.0 // indirect
|
||||
golang.org/x/oauth2 v0.7.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.7.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
golang.org/x/tools v0.8.1-0.20230428195545-5283a0178901 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/api v0.114.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
|
||||
google.golang.org/grpc v1.54.0 // indirect
|
||||
golang.org/x/tools v0.9.3 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/uint128 v1.3.0 // indirect
|
||||
modernc.org/cc/v3 v3.40.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.13 // indirect
|
||||
modernc.org/libc v1.22.5 // indirect
|
||||
modernc.org/cc/v3 v3.41.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.14 // indirect
|
||||
modernc.org/libc v1.24.1 // indirect
|
||||
modernc.org/mathutil v1.5.0 // indirect
|
||||
modernc.org/memory v1.5.0 // indirect
|
||||
modernc.org/memory v1.6.0 // indirect
|
||||
modernc.org/opt v0.1.3 // indirect
|
||||
modernc.org/sqlite v1.22.1 // indirect
|
||||
modernc.org/sqlite v1.23.1 // indirect
|
||||
modernc.org/strutil v1.1.3 // indirect
|
||||
modernc.org/token v1.1.0 // indirect
|
||||
)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
package main
|
||||
|
||||
//go:generate tinygo build -o hello_world.wasm -scheduler=none -gc=leaking --no-debug -target=wasi main.go
|
||||
// go:generate tinygo build -o hello_world.wasm -scheduler=none -gc=leaking --no-debug -target=wasi main.go
|
||||
//go:generate mockery
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package module
|
||||
|
||||
//go:generate go run github.com/mailru/easyjson/easyjson -all hello_world.go
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
|
6
go.mod
6
go.mod
|
@ -3,13 +3,9 @@ module code.icb4dc0.de/buildr/wasi-module-sdk-go
|
|||
go 1.20
|
||||
|
||||
require (
|
||||
github.com/mailru/easyjson v0.7.7
|
||||
github.com/tetratelabs/tinymem v0.1.0
|
||||
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
|
||||
google.golang.org/protobuf v1.30.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
)
|
||||
require github.com/google/go-cmp v0.5.9 // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -2,10 +2,6 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS
|
|||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/tetratelabs/tinymem v0.1.0 h1:Qza1JAg9lquPPJ/CIei5qQYx7t18KLie83O2WR6CM58=
|
||||
github.com/tetratelabs/tinymem v0.1.0/go.mod h1:WFFTZFhLod6lTL+UetFAopVbGaB+KFsVcIY+RUv7NeY=
|
||||
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
package sdk
|
||||
|
||||
//go:wasm-module buildr
|
||||
//export log_msg
|
||||
//go:wasmimport log_msg
|
||||
func _log_msg(ptr, size uint32)
|
||||
|
||||
//go:wasm-module buildr
|
||||
//export get_state
|
||||
//go:wasmimport get_state
|
||||
func _get_state(ptr, size uint32) (ptrSize uint64)
|
||||
|
||||
//go:wasm-module buildr
|
||||
//export set_state
|
||||
//go:wasmimport set_state
|
||||
func _set_state(ptr, size uint32) (ptrSize uint64)
|
||||
|
|
|
@ -45,7 +45,7 @@ func UnifiedPtrToSizePtr(uint64ptr uint64) (ptr uint32, size uint32) {
|
|||
return uint32(uint64ptr >> 32), uint32(uint64ptr)
|
||||
}
|
||||
|
||||
//export allocate
|
||||
//go:wasmimport allocate
|
||||
func Allocate(size uint32) uintptr {
|
||||
pointersLock.Lock()
|
||||
defer pointersLock.Unlock()
|
||||
|
@ -57,7 +57,7 @@ func Allocate(size uint32) uintptr {
|
|||
return unsafePtr
|
||||
}
|
||||
|
||||
//export deallocate
|
||||
//go:wasmimport deallocate
|
||||
func Deallocate(ptr uintptr) {
|
||||
pointersLock.Lock()
|
||||
defer pointersLock.Unlock()
|
||||
|
|
Loading…
Reference in a new issue