Git Product home page Git Product logo

play's Introduction

2020 Update

  • The compile.jsgo.io and play.jsgo.io services have been shut down.
  • Anything deployed to jsgo.io or pkg.jsgo.io will continue to work fine.

I created the jsgo.io system several years ago, and it costs about $150/month to host which I pay personally. I'm tightening up my finances right now, so this outgoing had to stop.

If anyone would like to host it for me (it runs on a single GKE n1-standard-2 instance), please let me know and we can get it back online!

I had a plan for a big rewrite that would make is possible to run on App Engine, thus reduce the cost to almost zero. Unfortunately this is something I'm hesitant to start, because it seems that Go on the client is moving away from GopherJS and towards WASM.

play.jsgo.io

Edit and run Go in the browser, supporting arbitrary import paths!

https://play.jsgo.io/

title936803092

The jsgo playground is an extension of the jsgo compiler. The compiler allows you to easily compile Go to JS using GopherJS, and automatically host the results in an aggressively cached CDN. The playground adds an online editor and many other features (see below).

The unique feature of the jsgo playground is that it supports arbitrary import paths. Other Go playgrounds are limited to just the Go standard library.

For more for more info:

Demos

Here's the simplest demo - it just writes to the console and to the page:

Here's a couple of simple demos that accept files by drag and drop. The first compresses dropped files to a zip. The second compresses images to jpg. They use the Go standard library zip / image libraries, which work flawlessly in the browser:

The amazing ebiten 2D games library is a perfect example of the power of Go in the browser. Here's some demos:

Contact

If you'd like to chat more about the project, feel free to add an issue, mention @dave or post in the #gopherjs channel of the Gophers Slack. I'm happy to help!

Features

Initialise

The URL can be used to initialise with code in several ways:

  • Load a Go package with /{{ Package path }}
  • Load a Github Gist with /gist.github.com/{{ Gist ID }}
  • Load a shared project with /{{ Share ID }}
  • Load a play.golang.org share with /p/{{ Go playground ID }}

run

Run

Click the Run button to run your code in the right-hand panel. If the imports have been changed recently, the dependencies will be refreshed before running.

format

Format code

Use the Format code option to run gofmt on your code. This is executed automatically when the Run, Update, Share or Deploy features are used.

update

Update

If you update a dependency, use the Update option, which does the equivalent of go get -u and refreshes the changes in any import or dependency.

share

Share

To share your project with others, use the Share option. Your project will be persisted to a json file on src.jsgo.io and the page will update to a sharable URL.

deploy

Deploy

To deploy your code to jsgo.io, use the Deploy feature. A modal will be displayed with the link to the page on jsgo.io, and the Loader JS on pkg.jsgo.io.

Use the jsgo.io link for testing and toy projects. Remember you're sharing the jsgo.io domain with everyone else, so the browser environment should be considered toxic.

The Loader JS on pkg.jsgo.io can be used in production, and should be added to a script tag on your own website. See github.com/dave/jsgo for more information.

console

Console

Writes to os.Stdout are redirected to a playground console, which can be toggled using the Show console option. The console will automatically appear the first time it's written to.

minify

Minify

In normal usage, all JS is minified. For debugging, this can be toggled with the Minify JS option.

tags

Build tags

The build tags used when compiling can be edited with the Build tags... option. The selected build tags are persisted when using the Share feature.

download

Download

The Download option downloads the project. Single file projects are downloaded as a single file, while multi-file projects download as a zip.

download

Upload

Files can be uploaded to the project simply by drag+drop. Zip files generated by the Download feature can be uploaded to restore a multi-file project.

files

File menu

Change the selected file with the file menu.

add-file

Add file

Add a file to the current package with the Add file option. Only .go, .md and .inc.js files are supported. If no extension is supplied, .go is added.

delete-file

Delete file

Delete a file from the current package with the Delete file option.

package

Package menu

Change the selected package with the package menu.

add-package

Add package

Add an empty package with the Add package option.

load-package

Load package

The source for an import or dependency can be loaded with the Load package option. By default, only the direct imports of your project are listed. Use the Show all dependencies option to show the entire dependency tree.

remove-package

Remove package

A package can be removed with the Remove package option.

Run locally?

If you'd like to run play.jsgo.io locally, take a look at these instructions.

play's People

Contributors

dave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

play's Issues

Missing messages package - doesn't compile

Current master doesn't compile

Looks like its missing the messages package in the jsgo repo?

actions/actions.go:6:2: cannot find package "github.com/dave/jsgo/server/messages"

I pulled the latest code on both repos.

panic : Dir not found

Hello Dave.I am a college student try to run the project locally for an education purpose.

First , I am not sure what should be contain in the "assets.zip" file so I just put a single main.go file
that just print out hello world.

After downloaded the zip to the directory,I had tried to start a go server which give me an output
"panic : Dir not found for github.com/dave/jsgo/assets/static/"
which the static directory is exist.

In summary,I just cloned the git into my gopath/src directory and downloaded assets.zip to the specific
directory without remove or modify any file or directory.
1

dockerized version

Hi,

Hope you are all well !

I was trying play online for a couple of advanced tests (package analysis, ast/import, flogo plugins, ...) and they failed because of write permissions. So I tried to build "play" or "jsgo" locally but it since it can not find the "message" package...

Is there a dockerize version (alpine based) for play and jsgo ?
It would so convenient for users or devs :-)

Thanks for all this cool project !

Cheers,
Rosco

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.