{"id":16193562,"url":"https://github.com/domblack/forkinggoruntime","last_synced_at":"2025-08-01T01:07:50.101Z","repository":{"id":147343361,"uuid":"597435591","full_name":"DomBlack/ForkingGoRuntime","owner":"DomBlack","description":"Code \u0026 Slides for my talk at GopherCon UK 2023","archived":false,"fork":false,"pushed_at":"2023-10-25T08:12:27.000Z","size":34149,"stargazers_count":13,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T03:34:23.102Z","etag":null,"topics":["conference-talk","golang","gophercon","gophercon-talk"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DomBlack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-04T14:47:17.000Z","updated_at":"2024-04-20T00:10:50.000Z","dependencies_parsed_at":"2023-07-02T16:15:48.633Z","dependency_job_id":"7564ce1b-50d5-4a45-90cf-54cbefdeec7b","html_url":"https://github.com/DomBlack/ForkingGoRuntime","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DomBlack%2FForkingGoRuntime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DomBlack%2FForkingGoRuntime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DomBlack%2FForkingGoRuntime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DomBlack%2FForkingGoRuntime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DomBlack","download_url":"https://codeload.github.com/DomBlack/ForkingGoRuntime/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244357368,"owners_count":20440315,"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":["conference-talk","golang","gophercon","gophercon-talk"],"created_at":"2024-10-10T08:15:29.658Z","updated_at":"2025-03-19T04:30:41.459Z","avatar_url":"https://github.com/DomBlack.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The adventurer's guide to forking the go runtime\n\nThis repo contains the code and [sides](./slides.pdf) for a talk I gave at GopherCon UK 2023 on how by creating\na rolling fork of the language we use every day can massively improve our experience as developers.\n\nThis talk is loosely based on how [Encore](https://encore.dev) uses a rolling fork of the Go runtime to add automatic tracing and unit test isolation to applications built using Encore without the developers of those applications having to add anything to their code bases. You can checkout [Encore Go Rolling Fork](https://github.com/encoredev/go) and [Encore's runtime library](https://github.com/encoredev/encore/tree/main/runtime) to see the results of this talk being used in practice.\n\n## Talk Videos\n\n- [A short version given at a London Gophers meetup](https://www.youtube.com/watch?v=CymVdee2Q8Y)\n- [The full version given at GopherCon UK 2023](https://www.youtube.com/watch?v=MRZU5J29Rys)\n\n## Example app\n\nThe example app is a simple todo app. It contains three services:\n\n- `todo-svc` - The todo service is responsible for managing the todos for users\n- `user-svc` - The user service is responsible for authenticating users. In this example it's hardcoded to only allow\n  one user with bearer token `secret`.\n- `api-svc` - The API service acts the the gateway for the user's requests. It is responsible for authenticating the user\n  against the `user-svc` and then forwarding the request to the `todo-svc`.\n\n### Branches\n\nThere are several branches with various different stages of tracing enabled:\n- `before-tracing` contains all a clean version of the example application with no modifications to Go\n- `initial-tracing-code` tracks trace context against Go routines, adding hooks into the standard library to track HTTP servers handling requests, and HTTP clients making calls.\n- `main` contains a final version of the code, in which we pass a Trace Context between services to maintain context, track database calls being made and emit traces to Jaeger\n- `with-goroutine-tracing` adds spans for every Go routine which is spawned during the trace.\n\n### Running the example app\n\nTo run the apps you will need to brew install `make`, `postgres` and `overmind`.\n\n```bash\nmake initdb        # Create the database\nmake postgres \u0026    # Start the database\nmake jaeger \u0026      # Start Jaeger via a Docker image\nmake microservices # Start the microservices (you only need to run this when changing branches)\n```\n\n### Example API calls\n\n```bash\n# List todos for user 1\ncurl -H \"Authorization: Bearer secret\" http://localhost:8080/todos\n\n# Create todo for user 1\ncurl -H \"Authorization: Bearer secret\" http://localhost:8080/todos -X \"POST\" -d `{\"title\":\"My Todo\"}`\n\n# Read the first todo\ncurl -H \"Authorization: Bearer secret\" http://localhost:8080/todos/1\n\n# Update title for the first todo\ncurl -H \"Authorization: Bearer secret\" http://localhost:8080/todos/1 -X \"PATCH\" -d `{\"title\":\"New title\"}`\n\n# Update completed for the first todo\ncurl -H \"Authorization: Bearer secret\" http://localhost:8080/todos/1 -X \"PATCH\" -d `{\"completed\":true}`\n\n# Delete the first todo\ncurl -H \"Authorization: Bearer secret\" http://localhost:8080/todos/1 -X \"DELETE\"\n\n```\n\n## Differences between the talk and this repo\n\nIn the talk, I said we'd embed Go as a submodule, however to keep this code easier to switch between states, this repo actually uses subtrees which allows us to track changes in the Go runtime per branch without having to reapply patches or push changes into an upstream submodule.\n\nFor a example of how I talked about managing the fork, check out the [Encore Go Rolling Fork](https://github.com/encoredev/go).\n\nThe initial subtree was added to this repo using this command:\n\n```bash\ngit subtree pull --prefix go-src https://go.googlesource.com/go release-branch.go1.20 --squash\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomblack%2Fforkinggoruntime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomblack%2Fforkinggoruntime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomblack%2Fforkinggoruntime/lists"}