Help wanted - ReferenceError: Go is not defined error

744 views
Skip to first unread message

jon.ki...@gmail.com

unread,
Apr 6, 2019, 2:08:17 PM4/6/19
to golang-nuts
I am new to Go programming.  I stumbled across a project for using WeAssembly at https://github.com/golang/go/wiki/WebAssembly and decided to give it a try.  So I'm running a test website on the Google App Engine, and the website is running on Go.  I created all the objects according to the documentation provided on the page, but every time I run the website, I get this error in the console:  Uncaught ReferenceError: Go is not defined

I'm expecting to see "Hello World" in the console of the browser, but instead I get the above error.  I'm sure it's pointing to the section "const go = new Go();", but I'm not sure why I'm getting this error.  I'm running the latest version on Chrome on Win10.  The test website is at https://test-rest-api-236401.appspot.com/ currently running the code giving me the error.  I've tried simplifying it based on other pages also pointing to WASM documentation, but I keep getting the same error.  I've done extensive searching and I've not seen anyone get this particular error.  Please help.  What am I missing?

Here's how the source is laid out on the page:
I'm currently running Go 1.12

/app.yaml  --used to run the website
/index.html  -- used to run the website and init the wasm go code
/main.go  -- used to run the website
/static/cmd/test.wasm   -- my compiled wasm hello world go code
/static/cmd/test.go  -- I don't believe I actually need this here since I have the .wasm file there.  I've tried it with and without it and still get the error.
/static/scripts/wasm_exec.js  -- version is the latest from the 1.12 source, but I've alternatively tried older versions from 1.11.x



Agniva De Sarker

unread,
Apr 6, 2019, 3:12:45 PM4/6/19
to golang-nuts
Remove the async attribute from your script tag.

jon.ki...@gmail.com

unread,
Apr 6, 2019, 4:50:22 PM4/6/19
to golang-nuts
Solved!  Thank you so much, can't believe I missed that.  
Reply all
Reply to author
Forward
0 new messages