{"id":23660223,"url":"https://github.com/primecitizens/pcz","last_synced_at":"2025-09-01T14:31:57.638Z","repository":{"id":193028357,"uuid":"686709712","full_name":"primecitizens/pcz","owner":"primecitizens","description":"A reimagination of Go, using unmodified official toolchain","archived":false,"fork":false,"pushed_at":"2023-10-10T16:14:56.000Z","size":10249,"stargazers_count":169,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T19:46:57.302Z","etag":null,"topics":["go","golang","std","stdlib","toolchain","wasm","webapp"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/primecitizens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-03T17:35:32.000Z","updated_at":"2025-03-10T08:41:25.000Z","dependencies_parsed_at":"2023-09-06T12:43:32.882Z","dependency_job_id":null,"html_url":"https://github.com/primecitizens/pcz","commit_stats":null,"previous_names":["primecitizens/pcz"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/primecitizens/pcz","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primecitizens%2Fpcz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primecitizens%2Fpcz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primecitizens%2Fpcz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primecitizens%2Fpcz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primecitizens","download_url":"https://codeload.github.com/primecitizens/pcz/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primecitizens%2Fpcz/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273139722,"owners_count":25052484,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["go","golang","std","stdlib","toolchain","wasm","webapp"],"created_at":"2024-12-29T03:30:00.533Z","updated_at":"2025-09-01T14:31:55.760Z","avatar_url":"https://github.com/primecitizens.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pcz\n\n\u003e **Warning**\n\u003e This project is in its 'move fast and break things' stage, **everything** is **EXPERIMENTAL**.\n\nA reimagination of Go, using unmodified official toolchain (currently `go1.21`).\n\n## Goals\n\n- Be FFI friendly: unless it's a kernel, all useful programs work with FFI heavily.\n- Work natively\n  - Adapt to the running enviornment rather than insisting an opinionated way.\n  - Provide platform native APIs: managing platform SDKs really sucks, do no more!\n- Expand* adoption of Go to...\n  - Web/Nodejs applications.\n  - Cross-platform GUI with native experience (native GUI widgets).\n  - Low-level system programming (think `crun`, `systemd`), EFI applications.\n  - Kernel and Firmware.\n\n*There are already impressive achievements made in these areas using official std.\n\n## Non-Goals\n\n- Change the way the Go team works or make them change their decisions.\n\n## Components\n\n- `std`: A custom Go standard library and runtime.\n\n- `pcz`: A tool to build applications using custom std.\n  - `pcz build` works like `go build` (invoking `go tool compile/asm/link/pack`) but with different options.\n  - `pcz dev` provides easy development enironment setup.\n\n- `h2y`: A library to flatten AST.\n  - generate API specifications from C/Objective-C header files and WebIDL files (using `llvm` and `webidl2.js`).\n\n- `ffigen`: A library to create go packages from specifications generated by `h2y`.\n\n\u003e **NOTE**\n\u003e We will open source `h2y` and `ffigen` after all platform sdks are added and the project itself gained enough popularity.\n\n## Installation\n\n1. Install `go1.21` toolchain to your working machine\n   - If you don't have any go toolchain installed, please refer to the [official Go installation doc](https://go.dev/doc/install) for guidance.\n   - Otherwise, you can download and install it by running `go install golang.org/dl/go1.21.2@latest` and `\"$(go env GOPATH)/bin/go1.21.2\" install`, then it's available as `\"$(go env GOPATH)/bin/go1.21.2\"`.\n\n2. Install `pcz` from source code like most cli tools written in Go. (After running the command below, you may find the `pcz` at `\"$(go env GOPATH)/bin/pcz\"`)\n\n  ```bash\n  go install github.com/primecitizens/pcz\n  ```\n\n## Usage\n\nHere are some [examples](./examples/) for your reference.\n\nIn General:\n\n- Use `github.com/primecitizens/pcz/std` as your stdlib, and make sure your application doesn't use packages from the official std.\n  - Some of the packages may work, but due to the lacking of GC, there can be memory leaks in you application.\n- Run `pcz` with `go1.21` toolchain, no other version of go toolchain is supported for now.\n  - You can ensure this by setting the environment variable `GOROOT` to the path to the toolchain home (if `pcz` wasn't built with local `go1.21` toolchain).\n- Import the runtime package explicitly (`import _ github.com/primecitizens/pcz/std/runtime`) in your application (usually inside the `main` package).\n  - This is because `pcz build` doesn't implicitly include a runtime for you.\n\n\u003e **NOTE**\n\u003e The std module is meant to be compatible with the go toolchain by using `pcz` (not the `go` command).\n\n## Go Language Support\n\n- [ ] `append`\n- [x] `make`\n  - [x] `slice`\n  - [ ] `map`\n  - [ ] `chan`\n- [x] `new`\n- [ ] `go`\n- [ ] `defer`\n  - [x] inlined `defer`\n  - [ ] `runtime.deferproc(deferFn)`\n- [ ] `panic`\n  - [ ] stacktrace\n  - [ ] `recover`\n- [ ] `map`\n  - [ ] access (`val, ok := m[key]`)\n  - [ ] assign (`m[key] = val`)\n  - [ ] delete (`delete(m, key)`)\n- [ ] `chan`\n  - [ ] send (`chan \u003c- x`)\n  - [ ] receive (`x, ok := \u003c- chan`)\n  - [ ] `close`\n- [ ] `select`\n  - [ ] block (`select {}`)\n  - [ ] blocking (without default branch)\n  - [ ] non-blocking (with default branch)\n- [ ] type switch (`switch x.(type)`)\n- [ ] type assertions (`y, ok := x.(T)`)\n- [x] `clear`\n- [x] `min`, `max` (compiler intrinsic)\n\n\u003e **NOTE**\n\u003e When using `make` and `new`, memory will be allocated using the default allocator of the current goroutine, which can be obtained by calling `thread.G().G().DefaultAlloc()`.\n\u003e\n\u003e Currently our major focus is on providing support for platfrom natvie apis, thus most Go language features except those doesn't require runtime support are missing, this is mainly because most runtime features require allocation and scheduling, thus depends on platform apis we are working on (see [ROADMAP.md](https://github.com/primecitizens/pcz/blob/master/ROADMAP.md) for more details).\n\n## Contributing\n\nRead [CONTRIBUTING.md](./CONTRIBUTING.md) for general guidelines.\n\nSome elementary tasks:\n\n- documentation\n  - estimate the minimum brain power need to understand the design.\n- find `TODO`s in the source code and implement.\n  - start from [`ffi/js`](./std/ffi/js/) can be a good choice.\n- create meaningful examples.\n\nSome intermediate tasks:\n\n- parallel package build.\n- port libraries from the official std with careful redesign.\n  - reimplement protocols with the new `encoding/binary`\n  - minimum allocation.\n- implement `math/matrix` package\n\nSome hard tasks:\n\n- (UI) design and implement a constraint-layout resolver.\n  - for web apps, it will replace the CSS box model (as we are going avoid using html attributes as much as possible (e.g. `id`, `name`)).\n  - for native platforms, it will be used to layout native widgets.\n- (sched) design a framework for writing scheduler\n- (gc) design a framework for writing garbage collectors based on the write barrier generated by Go toolchain.\n\n## Credits\n\nThis project won't be possible without the excellent work done by the Go team, if it was not the Go programming language, we could never find love in programming, let alone this project.\n\nWe would also like to thank everyone adopting Go to make programming in general more accessible to laypeople/peasants like us, your splendid resources really helped us to improve our understandings and skills.\n\n## LICENSE\n\nWebIDL files copied from the Chromium project are licensed under its [BSD 3-Clause License (LICENSE.chromium)](./LICENSE.chromium).\n\nCode written by Prime Citizens is licensed under the [Apache-2.0 License](./LICENSE):\n\n```txt\nCopyright 2023 The Prime Citizens\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimecitizens%2Fpcz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimecitizens%2Fpcz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimecitizens%2Fpcz/lists"}