Description
One blocking issue I'm running into with shurcooL/Go-Package-Store#18 right now is this.
It imports .../gopherjs/build
(indirectly) and compiles the frontend .go code to JavaScript when serving html.
That works fine. The problem is with distributing the root package.
Normally, when you do go get -u some/package
, go get will recursively get all of its dependencies.
So, currently to install Go Package Store (with javascript, not GopherJS):
go get -u github.com/shurcooL/Go-Package-Store
However, since the .go code for GopherJS is hidden behind a // +build js
tag, the dependencies of the go code meant to be compiled by GopherJS compiler are not fetched.
I tried to do an import with blank identifier to force go get to get dependencies, but that causes compile errors as the meant-for-GopherJS has init()
and global variables that are executed and cause panics, since the DOM isn't available.
My best runner-up alternative solution right now is to change the installation steps to:
go get -u github.com/shurcooL/Go-Package-Store
go get -u -d -tags=js github.com/shurcooL/Go-Package-Store/...
But that's twice the steps and pretty unidiomatic...
I'm looking for suggestions for better ways, if anyone can share some ideas.
(Note that I don't want to include the generated javascript inside the repository; I'd really prefer to have it compiled on demand from source when the process starts. It's not very slow, and it makes the code cleaner. But of course that's a viable alternative; to bake in the generated javascript instead of generating it at runtime... This is something go generate
may come in handy for.)