🛡️
Hogosuru
  • What is Hogosuru?
    • How it works?
    • Minimal requirements to load a wasm
    • Repositories
  • Guides
    • Configure your environment
    • Web API support
    • Create your first project
    • Load and parse a JSON data
    • Create HTML entities and manipulating DOM
      • Create some dynamic content
      • Attach to existing content
      • Modify CSS and attributes
      • Repeat content using template
    • Async work with Promise
    • Network IO: An example with gofiber
    • Observers: Your data always up to date
    • Create a single app with hogosuru
      • Example
Powered by GitBook
On this page
  • Use WebAssembly in your IDE
  • Live testing
  1. Guides

Configure your environment

Before startint your first project, it's best to spend some time setting up your work environment. This will allow you to save working time and productivity.

I personally prefer to work with visual studio code, but the explanations above will be easily transposable to your case.

Use WebAssembly in your IDE

By default, the GOOS AND GOARCH follow your config hardware. The binary product by go must be in "webassembly" format. To configure Go, you must set the GOOS and GOARCH env variable with value:

GOOS=js and GOARCH=wasm

For visual studio code, create a .vscode/settings.json file with:

{
    "go.buildTags": "js,wasm",
    "go.testEnvVars": {
        "GOARCH":"wasm",
        "GOOS": "js",
    },
    "go.testTags": "js,wasm",

}

Live testing

The normal way to test your app is compile your app in a wasm file with go or tinygo, upload it to a static serve file, and test with your favorite browser.

The only drawback is that solution works only with chrome for the moment.

My fork of wasmbrowsertest contains a useful function for hogusuru, this function will be integrated in some further iteration of wasmbrowsertest

Install wasmbrowsertest:

go install github.com/realPy/wasmbrowsertest@f20c27876ce20bbce5b971af53a67a745825a7d3
sudo cp ~/go/bin/wasmbrowsertest /usr/local/bin/go_js_wasm_exec

You are now ready to run your first project now

PreviousRepositoriesNextWeb API support

Last updated 3 years ago

This task can be automated , but consume lots of time. Thanks to you can live testings your apps with the "go run" standard function.

https://github.com/agnivade/wasmbrowsertest