Closed PeerXu closed 8 years ago
But failed on
compiler.Compile
method. Got the error:Compile: prog.go:3:8: could not import honnef.co/go/js/xhr (Config.Importer.Import(honnef.co/go/js/xhr) returned nil but no error)
Have you tried looking into the details? Why does it return nil but no error? What does it do for other packages?
It is right, I should not check error after compiler.Compile
immediately.
I want to compile some golang program online, but failed to compile (on
compiler.Compile
) it. There is my program.codeString
is imported the 3rd. library code string, I want to compile and run it online. But failed oncompiler.Compile
method. Got the error:Compile: prog.go:3:8: could not import honnef.co/go/js/xhr (Config.Importer.Import(honnef.co/go/js/xhr) returned nil but no error)
There is my steps:
playground.go
file.gopherjs build playground.go -o index.js
index.js
python -m SimpleHTTPServer 8000
pkg
folder to my folder, and copyhonnef.co/go/js/xhr
package to correct path.http://localhost:8000
and get the error on js console.index.html
:thanks.