{"id":41332482,"url":"https://github.com/jespino/having-fun-with-the-go-source-code-workshop","last_synced_at":"2026-01-23T06:18:20.340Z","repository":{"id":318069185,"uuid":"1055732485","full_name":"jespino/having-fun-with-the-go-source-code-workshop","owner":"jespino","description":"Having Fun with the Go Source Code Workshop","archived":false,"fork":false,"pushed_at":"2025-10-31T07:41:34.000Z","size":182,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-31T09:28:16.249Z","etag":null,"topics":["go","internals","workshop"],"latest_commit_sha":null,"homepage":"https://jespino.github.io/having-fun-with-the-go-source-code-workshop/","language":"HTML","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/jespino.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-12T18:01:04.000Z","updated_at":"2025-10-31T07:41:38.000Z","dependencies_parsed_at":"2025-10-15T13:32:34.186Z","dependency_job_id":null,"html_url":"https://github.com/jespino/having-fun-with-the-go-source-code-workshop","commit_stats":null,"previous_names":["jespino/having-fun-with-the-go-source-code-workshop"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jespino/having-fun-with-the-go-source-code-workshop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespino%2Fhaving-fun-with-the-go-source-code-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespino%2Fhaving-fun-with-the-go-source-code-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespino%2Fhaving-fun-with-the-go-source-code-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespino%2Fhaving-fun-with-the-go-source-code-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jespino","download_url":"https://codeload.github.com/jespino/having-fun-with-the-go-source-code-workshop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jespino%2Fhaving-fun-with-the-go-source-code-workshop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28682258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","internals","workshop"],"created_at":"2026-01-23T06:18:19.814Z","updated_at":"2026-01-23T06:18:20.319Z","avatar_url":"https://github.com/jespino.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Having Fun with the Go Source Code Workshop\n\nWelcome to an interactive workshop where you'll learn how to modify and experiment with the Go programming language source code! This hands-on workshop will guide you through understanding, building, and making changes to the Go compiler and runtime. 🎯\n\n**📌 This workshop uses Go version 1.25.1** - we'll check out the specific release tag to ensure consistency across all exercises.\n\n## 📋 Prerequisites\n\n- 🐹 Basic knowledge of Go programming\n- 💻 Familiarity with command line tools\n- 🗂️ Git installed on your system\n- **⚡ Go compiler version 1.24.6 or newer** (required for bootstrapping the build process)\n- 💾 At least 4GB of free disk space\n\n## 🎓 Workshop Overview\n\nThis workshop consists of 10 exercises that will take you through the process from building Go from source, and making modifications at different places in the compiler, tooling and runtime. You'll gain some insights about the Go internals, from things like the lexer or parser, to runtime behaviors:\n\n### 🌱 [Exercise 0: Introduction and Setup](./exercises/00-introduction-setup.md)\n\nGet started by cloning and setting up the Go source code environment.\n\n### 🔨 [Exercise 1: Compiling Go Without Changes](./exercises/01-compile-go-unchanged.md)\n\nLearn to build the Go toolchain from source without any modifications.\n\n### ⚡ [Exercise 2: Adding the \"=\u003e\" Arrow Operator for Goroutines](./exercises/02-scanner-arrow-operator.md)\n\nLearn scanner/lexer modification by adding \"=\u003e\" as an alternative syntax for starting goroutines.\n\n### 🔄 [Exercise 3: Multiple \"go\" Keywords - Parser Enhancement](./exercises/03-parser-multiple-go.md)\n\nLearn parser modification by enabling multiple consecutive \"go\" keywords (go go go myFunction).\n\n### ⚙️ [Exercise 4: Inline Parameters - Function Inlining Experiments](./exercises/04-compiler-inlining-parameters.md)\n\nExplore the inliner behavior by modifying function inlining parameters.\n\n### 🎨 [Exercise 5: gofmt Transformation - \"hello\" to \"helo\"](./exercises/05-gofmt-ast-transformation.md)\n\nLearn about Go's tools by modifying gofmt to modify \"hello\" to \"helo\" in code.\n\n### 🔍 [Exercise 6: SSA Pass - Detecting Division by Powers of Two](./exercises/06-ssa-power-of-two-detector.md)\n\nCreate a custom SSA compiler pass that detects division operations by powers of two that could be optimized to bit shifts.\n\n### 🕰️ [Exercise 7: Patient Go - Making Go Wait for Goroutines](./exercises/07-runtime-patient-go.md)\n\nModify the Go runtime to wait for all goroutines to complete before program termination.\n\n### 🕵️‍♂️ [Exercise 8: Goroutine Sleep Detective - Runtime State Monitoring](./exercises/08-goroutine-sleep-detective.md)\n\nAdd logging to the Go scheduler to monitor goroutines going to sleep.\n\n### 🎯 [Exercise 9: Predictable Select - Removing Randomness from Go's Select Statement](./exercises/09-predictable-select.md)\n\nModify Go's select statement implementation to be deterministic instead of random.\n\n### ☕ [Exercise 10: Java-Style Stack Traces - Making Go Panics Look Familiar](./exercises/10-java-style-stack-traces.md)\n\nTransform Go's verbose stack traces into Java-style formatting.\n\n## 🚀 Getting Started\n\n1. 🌱 Start with [Exercise 0](./exercises/00-introduction-setup.md) to set up your environment\n2. 📚 Work through the exercises in order\n3. 🔗 After exercise 1, you can pick and choose the exercise that you want.\n\n## 📁 Repository Structure\n\n```\n.\n├── README.md                 # This file\n├── exercises/               # Individual exercise files (markdown)\n│   ├── 00-introduction-setup.md\n│   ├── 01-compile-go-unchanged.md\n│   ├── 02-scanner-arrow-operator.md\n│   └── ...\n├── website-generator/       # Go program to generate website from markdown\n│   ├── main.go\n│   ├── templates.go\n│   └── README.md\n├── website/                 # Generated website (HTML)\n│   ├── index.html\n│   ├── 00-introduction-setup.html\n│   └── ...\n├── Makefile                 # Build automation\n└── go/                      # Go source code (cloned during setup)\n```\n\n## 🌐 Website Generator\n\nThis repository includes a Go program that automatically generates a static website from the markdown exercise files.\n\n### Generate the Website\n\n```bash\n# Using make (recommended)\nmake website\n\n# Or run directly\ncd website-generator\ngo run . -exercises ../exercises -output ../website\n```\n\n### Serve Locally\n\n```bash\n# Start a local web server\nmake serve\n\n# Then open http://localhost:8000 in your browser\n```\n\nThe website generator:\n- ✅ Converts markdown to HTML using [blackfriday](https://github.com/russross/blackfriday)\n- ✅ Preserves all formatting, emojis, and code blocks\n- ✅ Generates navigation between exercises\n- ✅ Creates an index page with exercise overview\n- ✅ Includes responsive CSS styling\n\nSee [website-generator/README.md](website-generator/README.md) for more details.\n\n## 💡 Tips for Success\n\n- ⏰ Take your time with each exercise - compiler internals are complex!\n- 🔍 Don't hesitate to explore the Go source code beyond what's required\n- 🌿 Use `git` to track your changes and revert when needed\n- 🧪 Test your modifications thoroughly with various Go programs\n\n## 📖 Resources\n\n- 🏗️ [Go Compiler Overview](https://github.com/golang/go/tree/master/src/cmd/compile)\n- 📋 [Go Language Specification](https://go.dev/ref/spec)\n- 🔧 [Go Runtime Documentation](https://pkg.go.dev/runtime)\n- 📚 [Go Internal Documentation](https://go.dev/src/)\n\n### 🎥 Video References\n\nThese workshop exercises are based on insights from my talks:\n\n- 🎬 [Understanding the Go Compiler](https://www.youtube.com/watch?v=qnmoAA0WRgE) - Deep dive into Go's compilation process\n- 🎬 [Understanding the Go Runtime](https://www.youtube.com/watch?v=YpRNFNFaLGY) - Exploration of Go's runtime system\n\n## 🏆 Workshop Completion\n\nUpon completing all exercises, you'll have:\n\n- ✅ **Built Go from source** and understood the bootstrap process\n- ✅ **Modified language syntax** by changing scanner and parser behavior\n- ✅ **Customized development tools** like gofmt and compiler optimizations\n- ✅ **Implemented SSA optimizations** in the compiler backend\n- ✅ **Modified runtime behavior** including program entry points and scheduler monitoring\n- ✅ **Altered concurrency algorithms** like select statement randomization\n- ✅ **Customized error reporting** with Java-style stack trace formatting\n\n**Congratulations!** You'll have gained the confidence to keep exploring the Go source code. This knowledge enables you to:\n\n- Start small contributions to the Go project\n- Build custom language variants and tools\n- Understand some trade-offs in language and runtime design\n\n## 🤝 Contributing\n\nFound an issue, have an improvement idea or want to add more exercises? Please [open an issue](https://github.com/jespino/having-fun-with-the-go-source-code-workshop/issues) or submit a pull request!\n\n---\n\n**Happy coding and welcome to the world of Go internals!** 🚀✨\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjespino%2Fhaving-fun-with-the-go-source-code-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjespino%2Fhaving-fun-with-the-go-source-code-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjespino%2Fhaving-fun-with-the-go-source-code-workshop/lists"}