{"id":28487347,"url":"https://github.com/live-codes/go2js","last_synced_at":"2025-07-01T21:32:03.099Z","repository":{"id":47662349,"uuid":"397838472","full_name":"live-codes/go2js","owner":"live-codes","description":"Compile Go to JS in the browser (using Gopherjs)","archived":false,"fork":false,"pushed_at":"2024-08-30T08:13:42.000Z","size":15698,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-25T17:06:08.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/live-codes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-19T06:20:34.000Z","updated_at":"2025-02-19T17:47:11.000Z","dependencies_parsed_at":"2022-09-04T15:51:01.346Z","dependency_job_id":null,"html_url":"https://github.com/live-codes/go2js","commit_stats":null,"previous_names":["hatemhosny/go2js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/live-codes/go2js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/live-codes%2Fgo2js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/live-codes%2Fgo2js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/live-codes%2Fgo2js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/live-codes%2Fgo2js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/live-codes","download_url":"https://codeload.github.com/live-codes/go2js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/live-codes%2Fgo2js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263039300,"owners_count":23404149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-08T04:30:48.776Z","updated_at":"2025-07-01T21:32:03.084Z","avatar_url":"https://github.com/live-codes.png","language":"CSS","funding_links":["https://ko-fi.com/N4N036P4Y"],"categories":[],"sub_categories":[],"readme":"# Go2JS\n\nCompile Go to JS in the browser (using [GopherJS](https://github.com/gopherjs/gopherjs))\n\nBased on [GopherJS Playground](https://github.com/gopherjs/gopherjs.github.io)\n\nThe motive for this project was to enable client-side compiling of Golang to JavaScript to run in the browser for [LiveCodes](https://github.com/live-codes/livecodes).\n\n## Usage\n\nUMD:\n\n```html\n\u003c!-- \u003cscript src=\"https://cdn.jsdelivr.net/npm/@live-codes/go2js/build/go2js.js\"\u003e\u003c/script\u003e --\u003e\n\u003cscript src=\"go2js.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  const code = `\npackage main\nimport (\"syscall/js\"\n\"fmt\")\nfunc main() {fmt.Println(\"Hello, from Go\")\njs.Global().Call(\"alert\", \"Hello, JavaScript\")\nprintln(\"Hello, JS console\")}\n`;\n  window.go2js\n    .format(code)\n    .then((formatted) =\u003e {\n      console.log(formatted);\n      // return window.go2js.compile(formatted, 'https://cdn.jsdelivr.net/npm/@live-codes/go2js/build/');\n      return window.go2js.compile(formatted);\n    })\n    .then(eval)\n    .catch(console.warn);\n\u003c/script\u003e\n```\n\nESM:\n\n```js\nimport { compile, format } from 'https://cdn.jsdelivr.net/npm/@live-codes/go2js';\n\nconst code = `\npackage main\nimport (\"syscall/js\"\n\"fmt\")\nfunc main() {fmt.Println(\"Hello, from Go\")\njs.Global().Call(\"alert\", \"Hello, JavaScript\")\nprintln(\"Hello, JS console\")}\n`;\n\nformat(code)\n  .then((formatted) =\u003e {\n    console.log(formatted);\n    // return compile(formatted, 'https://cdn.jsdelivr.net/npm/@live-codes/go2js/build/');\n    return compile(formatted);\n  })\n  .then(eval)\n  .catch(console.warn);\n```\n\nRun `npm start` to start a server (http://127.0.0.1:8080) and watch for changes.\n\n## Contribution\n\nPlease do!\n\nFeedback, ideas and pull requests are highly appreciated.\n\n## License\n\n[BSD 2-Clause \"Simplified\" License](LICENSE) same as GopherJS lisence\n\n## Support the author\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/N4N036P4Y)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flive-codes%2Fgo2js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flive-codes%2Fgo2js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flive-codes%2Fgo2js/lists"}