tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

Unknown import resetTimer - wasi

Open JeanArhancet opened this issue 3 years ago • 2 comments

Hello,

I am trying to use tinygo and wasi but I have an error with wasmtime: 1: unknown import: env::time.resetTimer has not been defined

main.go:

package main

 import (
	"io/ioutil"
	"log"
	"net/http"
	"fmt"
 )
 
 func main() {
	resp, err := http.Get("https://jsonplaceholder.typicode.com/posts")
	if err != nil {
	   log.Fatalln(err)
	}
	fmt.Println("Response status:", resp.Status)
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
	   log.Fatalln(err)
	}

	sb := string(body)
	fmt.Println(sb)
 }

The command: tinygo build -wasm-abi=generic -target=wasi -o main.wasm main.go

tinygo version: tinygo version 0.22.0 darwin/amd64 (using go version go1.17.6 and LLVM version 13.0.0)

JeanArhancet avatar Feb 14 '22 22:02 JeanArhancet

Dup of https://github.com/tinygo-org/tinygo/issues/1037 ?

dankegel avatar Feb 20 '22 01:02 dankegel

this one should be fixed on next release. However, the code won't work in wasi for another reason, which is that it doesn't support network calls needed for http.

codefromthecrypt avatar Sep 07 '22 07:09 codefromthecrypt

Released as part of v0.26.0

deadprogram avatar Sep 30 '22 06:09 deadprogram