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

WIN10下搭建WebAssembly GO编译环境

Luz5年前 (2020-04-26)ELSE5098

安装GO语言环境

     点此下载

image.png

    安装完成后截图

编译一个go语言测试程序

  1. package main
  2. import (
  3.     "fmt"
  4.     "io/ioutil"
  5.     "net/http"
  6.     "strings"
  7. )
  8. func GetData() {
  9.     client := &http.Client{}
  10.     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"))
  11.     defer resp.Body.Close()
  12.     body, err := ioutil.ReadAll(resp.Body)
  13.     if err != nil {
  14.         fmt.Println(err)
  15.     }
  16.     fmt.Println(string(body))
  17. }
  18. func main() {
  19. fmt.Printf("hello, world\n")
  20. GetData()
  21. }

image.png

    运行测试程序

image.png

切换编译目标为WASM

     设置环境变量

        image.png

     编译wasmimage.png

评论列表

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

太强了大佬

发表评论

访客

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