benthos-lab
benthos-lab copied to clipboard
tinygo
The latest release has been working for me on 2 golang projects so far.
Might be worth trying it out for benthos lab.
This is able to compile a golang badgerDB to tinygo.
all: g-dep js-dep js-dep-os g-all js-build
all-delete: g-dep-delete js-dep-delete
# https://github.com/genjidb/genji
LIB_NAME=genji
LIB=github.com/genjidb/$(LIB_NAME)
g-dep:
git clone https://$(LIB)
g-dep-delete:
rm -rf $(LIB_NAME)
g-init:
cd $(LIB_NAME) && go mod tidy
g-all:
cd $(LIB_NAME) && $(MAKE) all
g-gen:
cd $(LIB_NAME) && $(MAKE) gen
g-build:
cd $(LIB_NAME) && $(MAKE) build
g-test:
cd $(LIB_NAME) && $(MAKE) test
g-bench:
cd $(LIB_NAME) && $(MAKE) bench
g-run:
genji -h
#### JS / WASM
# https://github.com/genjidb/genji.js
JS_LIB_NAME=genji.js
JS_LIB=github.com/genjidb/$(JS_LIB_NAME)
js-dep:
git clone https://$(JS_LIB)
js-dep-delete:
rm -rf $(JS_LIB_NAME)
js-dep-os:
# tinygo
brew tap tinygo-org/tools
brew install tinygo
tinygo version
js-build:
# also calls tinygo.
cd $(JS_LIB_NAME) && yarn install && yarn build
Mhhh
No luck and i think it might be reflection, but need to look further.
here is repro of me trying to build benthos-lab.
dep tinygo:
brew tap tinygo-org/tools
brew install tinygo
tinygo version
build golang wasm: ( works )
GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o /Users/apple/workspace/go/src/github.com/gedw99/research/servers/dataflow/benthos/_bin/benthos-lab-wasm.wasm ./client/wasm/benthos-lab.go
build tinygo wasm: ( does not work )
tinygo build -o /Users/apple/workspace/go/src/github.com/gedw99/research/servers/dataflow/benthos/_bin/benthos-lab-wasm.wasm -target wasm --no-debug ./client/wasm/benthos-lab.go
../../../../../../../../pkg/mod/github.com/rcrowley/[email protected]/debug.go:4:2: package runtime/debug is not in GOROOT (/Users/apple/Library/Caches/tinygo/goroot-go1.16.2-53d3c84e483c6ef0ed352a46dda63ea5bb8115d56e71e900a29c71fcd629271d/src/runtime/debug)
/Users/apple/Library/Caches/tinygo/goroot-go1.16.2-53d3c84e483c6ef0ed352a46dda63ea5bb8115d56e71e900a29c71fcd629271d/src/net/http/pprof/pprof.go:73:2: package runtime/trace is not in GOROOT (/Users/apple/Library/Caches/tinygo/goroot-go1.16.2-53d3c84e483c6ef0ed352a46dda63ea5bb8115d56e71e900a29c71fcd629271d/src/runtime/trace)
make: *** [build-lab-tinygo] Error 1