Comments (21)
I've been meaning to write some documentation for setting it up locally... a docker container would be a great idea. I'll see what I can do in the next few days.
from play.
I made some instructions on how to get it running locally - can you run through them and see if there's any problems?
https://github.com/dave/jsgo/blob/master/LOCAL.md
from play.
Here is a quick example for a multi-stage docker file based on alpine and gopherjs/vecty, if it can help yout to save some precious time ^^.
https://github.com/nobonobo/vecty-chatapp/blob/master/Dockerfile
from play.
p.s. Setting this up as a docker container won't be trivial for two reasons:
- Instead of asking the internet for git repos it uses files in your GOPATH, so that would need to be mapped into the docker container.
- The initialisation step takes a few minutes (it pre-compiles all the standard library packages) and populates a temporary directory (defaults to
~/.jsgo-local/
) so this would need to be persisted if you wanted fast start-up.
from play.
Thanks I will try it tonight :-), will keep you update
Many thanks ^^
from play.
Later today I will try with that too, https://github.com/kassisol/docker-volume-git
from play.
Hi Dave,
Hope you are all well !
Many thanks for the local version, it makes my life so easier for testing some new golang packages. Your work is just amazing as it fits in many of my side projects on golang ast and package embedding.
I have a couple more questions, and one that probably I should I have posted in forky or golib, but I can re-publish them later if you do not mind.
Questions:
Fetch remote git repos in local mode
Actually, it seems that go packages have to be already installed in my GOPATH. And, by exploring the code, I saw that you use the the context struct from go/build, so I was wondering how complicated it would be to have jsgo with a custom GOPATH to fetch/load remote/local packages (without GCSE client)
Suggestion
Parse go test files*
- a. Would be awesome to detect the "testing" package and be able to run go tests.
- b. Parsing go tests ast and rewrite them into main package if upper solution is too complicated
- c. I have more questions but I will post an issue into forky for more clarity
Nb. Would be awesome to have a gitter chat for quick questions or suggestions (more convenient than slack for me)
Last word, you have made an amazing work dude ! How many brains do you have :-) ?!
Cheers,
Rosco
from play.
Hey Rosco, to get it to fetch git repos in local mode should be very simple... Take a look at:
https://github.com/dave/jsgo/blob/master/server/server.go
... we just need to change where it injects the fetcher (the bit that gets git repos) and the resolver (the bit that resolves go paths into git repos) into the server in local mode... I never extracted the "live" version of the resolver to an external service, so to use the live resolver, you just set it to nil. So... Change this:
if config.LOCAL {
fileserver = localfileserver.New(config.LocalFileserverTempDir, config.Static, config.Host, config.Bucket)
database = localdatabase.New(config.LocalFileserverTempDir)
fetcherResolver := localfetcher.New()
c = cache.New(
database,
fetcherResolver,
fetcherResolver,
config.HintsKind,
)
} else {
to this:
if config.LOCAL {
fileserver = localfileserver.New(config.LocalFileserverTempDir, config.Static, config.Host, config.Bucket)
database = localdatabase.New(config.LocalFileserverTempDir)
c = cache.New(
database,
gitfetcher.New(
cachefileserver.New(1024*1024*1042, 100*1024*1024),
fileserver,
config.GitFetcherConfig,
),
nil,
config.HintsKind,
)
} else {
... and it should work? (I didn't test this)
from play.
Parsing go test files shouldn't be too difficult to add, but I never implemented it for the jsgo ecosystem because it's not really needed.
from play.
Hey Rosco, to get it to fetch git repos in local mode should be very simple... Take a look at:
https://github.com/dave/jsgo/blob/master/server/server.go
... we just need to change where it injects the fetcher (the bit that gets git repos) and the resolver (the bit that resolves go paths into git repos) into the server in local mode... I never extracted the "live" version of the resolver to an external service, so to use the live resolver, you just set it to nil. So... Change this:
if config.LOCAL { fileserver = localfileserver.New(config.LocalFileserverTempDir, config.Static, config.Host, config.Bucket) database = localdatabase.New(config.LocalFileserverTempDir) fetcherResolver := localfetcher.New() c = cache.New( database, fetcherResolver, fetcherResolver, config.HintsKind, ) } else {to this:
if config.LOCAL { fileserver = localfileserver.New(config.LocalFileserverTempDir, config.Static, config.Host, config.Bucket) database = localdatabase.New(config.LocalFileserverTempDir) c = cache.New( database, gitfetcher.New( cachefileserver.New(1024*1024*1042, 100*1024*1024), fileserver, config.GitFetcherConfig, ), nil, config.HintsKind, ) } else {... and it should work? (I didn't test this)
Cool, I will test it now and post feedback later.
from play.
Parsing go test files shouldn't be too difficult to add, but I never implemented it for the jsgo ecosystem because it's not really needed.
Is there any roadmap or deck describing jsgo's ecosystem and goals ? I would be more than pleased to understand the origins/problems to solve that triggered this interesting project
from play.
No, there's no more documentation above what's in the readme.
from play.
Hi,
Hope you are all well !
Sorry for the delay, but I am playing with jsgo quite a lot, and it is really awesome.
I managed to make it work locally but I add to install some dependencies not mentioned in the doc. Also, for the docker container, I spent 2 days with an alpine based image but I had lots of tweaks to do in order to make it work (wasted lot of time that before finding that gopherjs check strictly the go version as I had v1.11.1 and not gov1.11). So, I need more time to get some packed properly on my side.
But, for now, I have some annoying errors that maybe you can help to sort out.
https://play.jsgo.io/github.com/shurcooL/gtdo
gopath/src/github.com/shurcooL/gtdo/doc_handler.go:203:31: New not declared by package select_menu
And, if you a the "dev" build tag, you get:
{"Time":"2018-10-16T16:20:52.712398+02:00","Error":"gopath/src/golang.org/x/sys/unix/timestruct.go:13:24: undeclared name: Timespec","Ip":""}
Saved playground link:
https://play.jsgo.io/58866e7121a00ee3b6bc79bad74acb191d67ef0c
Is there a way to pass build tags as query parameter with values, maybe comma separated, in the url ?
Thanks in advance
Cheers,
Rosco
from play.
Not sure why that's happening... But if that gtdo
package wasn't created with the jsgo
environment in mind then it's possible it needs changes to work... You might need to fork it and get it to work without that build tag... I'm guessing the dev
build tag causes something unrelated to load a package it shouldn't... I don't think golang.org/x/sys/unix
should be loading.
from play.
But wait gtdo
isn't a GopherJS app at all... I wouldn't expect it to work... It's trying to start a web server.
This is the GopherJS package: https://play.jsgo.io/github.com/shurcooL/gtdo/frontend/
... which runs, but doesn't work well probably because it's looking for static assets.
from play.
Here's it deployed: https://jsgo.io/shurcooL/gtdo/frontend
It's panicing here: https://github.com/shurcooL/gtdo/blob/22ff496d3dddd4f4b66788de296a336952d9fe70/frontend/frontend.go#L69
... because this isn't in the index page HTML: https://github.com/shurcooL/gtdo/blob/22ff496d3dddd4f4b66788de296a336952d9fe70/_data/head.html.tmpl#L10
from play.
Thanks for explanations above, I will continue to read gopherjs/vecty and jsgo codebases.
One thing, can you confirm that latest src-d update, 4 days ago, on `gopkg.in/src-d/go-git.v4/...", is generating the same error as above, on your side ?
have (sivafs.SivaFS)
want (billy.Filesystem, cache.Object)"
Last question, from your perspective, what are the benefits of gopherjs on the long run ? Is it "a nice to have" project for Google ? Some contacts argued that they could not find any serious boilerplate/demo for a real-world use case, so not suitable for agency/production purposes.
What made you write jsgo project ?
Gopherjs projects found:
https://gotools.org/github.com/gopherjs/gopherjs/js?tab=dependents
https://gotools.org/github.com/gopherjs/vecty?tab=dependents
from play.
I refreshed all my dependencies including gopkg.in/src-d/go-git.v4/...
but I'm not getting that error... Where does the error occur?
I love Go but I also love the front-end web. Running Go on the front-end is something I've always wanted to do.
Some contacts argued that they could not find any serious boilerplate/demo for a real-world use case, so not suitable for agency/production purposes.
Absolutely right. It's definitely not mature enough for "agency" purposes. Whether it's ready for production depends on the context. I'm running it in production with play.jsgo.io, and it works great.
The jsgo system is something I've always wanted to create, since first playing with GopherJS - the package splitting and caching specifically. Check out the little intro on https://github.com/dave/jsgo
from play.
weird ^^
Current HEADs:
- https://github.com/src-d/go-git/blob/master/storage/filesystem/storage.go#L37
- https://github.com/dave/services/blob/master/fetcher/gitfetcher/fetcher.go#L110
Here is my fixed file:
https://gist.github.com/roscopecoltran/e21836d5021ec18d3e90bf6d5b7d2f20#file-fetcher-go-L110
from play.
Hmm yes you're right... I'll take a closer look...
from play.
Aaah I had a branch checked out in my go-git directory, so it wasn't pulling the latest master. I've fixed the bug... give it a try now.
from play.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from play.