Skip to content

tuokaikyle/gobyexample-web

Repository files navigation

Gobyexample web

The web app lets you learn the go programming language by looking at code examples and doing actual coding alongside.

内含中文注释版。

Features

  • No sign up, no log in, no database, no password, no fee, no subscription.
  • Playground runner — write Go code in the app and run it through Go Playground API
  • Syntax highlighting — Shiki-powered code rendering
  • Mark as done — track completed topics with localStorage

Light mode

Light mode

Dark Mode

Dark mode

Tech stack

Vite + React + TypeScript + shadcn/ui + Shiki (syntax highlighting) + Cloudflare Pages Functions

To add components to your app, run the following command:

npx shadcn@latest add button

This will place the ui components in the src/components directory.

Go Playground runner

In V2 (the current version), the right-side playground sends the code to the Go Playground api.

In V1, it uses wasm so the go code runs in the browser. No backend and third party api needed. The downside is the app is ~40 MB large, and can't do IO operations.

Shiki optimization

createHighlighter is called with only the Go grammar and the two themes used (github-light, github-dark-dimmed), reducing overhead from 300+ language chunks to a minimal bundle.

Deploy to cloudflare

  • Cloudflare Pages build command: pnpm build
  • Cloudflare Pages output directory: dist
  • Cloudflare Pages automatically includes Functions from functions/

Source and License

The web app code is under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license.

The original golang code examples source code is from gobyexample. This work is copyright Mark McGranaghan and licensed under a Creative Commons Attribution 3.0 Unported License.

The code comments and explanations in Chinese is from this project by gobyexample-cn. This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license.

About

Web app of gobyexample

Resources

License

Stars

Watchers

Forks

Contributors