Redirects users to tested example (#791)

Rather than clutter both the README and home page with details that can
drift and have caused maintenance, this directs users to the tested
basic example.

This also adds a FAQ entry about TinyGo's main, thanks to @basvanbeek
for the help.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2022-09-01 09:12:37 +08:00
committed by GitHub
parent 1f4d945cb0
commit d54008922c
12 changed files with 124 additions and 170 deletions

10
examples/basic/testdata/add.go vendored Normal file
View File

@@ -0,0 +1,10 @@
package main
//export add
func add(x, y uint32) uint32 {
return x + y
}
// main is required for the `wasi` target, even if it isn't used.
// See https://wazero.io/languages/tinygo/#why-do-i-have-to-define-main
func main() {}

Binary file not shown.

View File

@@ -1,15 +0,0 @@
(module
;; Define the optional module name. '$' prefixing is a part of the text format.
$wasm/math
;; add returns $x+$y.
;;
;; Notes:
;; * The stack begins empty and anything left must match the result type.
;; * export allows api.Module to return this via ExportedFunction("add")
(func (export "add") (param $x i32) (param $y i32) (result i32)
local.get $x ;; stack: [$x]
local.get $y ;; stack: [$x, $y]
i32.add ;; stack: [$x+$y]
)
)