Gopherjs: invalid memory address or nil pointer dereference

Created on 18 Dec 2017  路  3Comments  路  Source: gopherjs/gopherjs

Looking for help : |
qq 20171219001135

question

Most helpful comment

looks like you are using go run to run gopherjs. It's generally okay to use go build or go install. But to run it, you might need to compile it to a js file.

All 3 comments

Worked for me in the playground. Suspect that Code doesn't provide the same environment as a browser, and that js.Global or js.Global.Get("document") is nil.

Try println(js.Global) and println(js.Global.Get("document")). And maybe try running your generated code in a browser or in Node.js, which are both supported environments. Not sure Code is.

looks like you are using go run to run gopherjs. It's generally okay to use go build or go install. But to run it, you might need to compile it to a js file.

锛欴 3q@kelwang

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hackwaly picture hackwaly  路  4Comments

dmitshur picture dmitshur  路  4Comments

flimzy picture flimzy  路  3Comments

linkerlin picture linkerlin  路  3Comments

flimzy picture flimzy  路  4Comments