-->
当前位置:首页 > ELSE > 正文内容

WIN10下搭建WebAssembly GO编译环境

Luz4年前 (2020-04-26)ELSE4426

安装GO语言环境

     点此下载

image.png

    安装完成后截图

编译一个go语言测试程序

package main
import (
    "fmt"
    "io/ioutil"
    "net/http"
    "strings"
)
func GetData() {
    client := &http.Client{}
    resp, err := client.Post("http://39.96.60.14:5000/get_puk_sq","application/x-www-form-urlencoded",strings.NewReader("ip=1.1.1.1"))
    defer resp.Body.Close()
    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println(string(body))
}
func main() {
	fmt.Printf("hello, world\n")
	GetData()
}

image.png

    运行测试程序

image.png


切换编译目标为WASM

     设置环境变量

        image.png

     编译wasmimage.png

评论列表

访客
访客
4年前 (2020-04-26)

太强了大佬

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。