百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

go-kata

> 编程语言
开源

一系列每日编码挑战,旨在通过有意识的、重复的练习帮助您掌握 Go 的习惯用法。

2.4K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一系列每日编码挑战,旨在通过有意识的、重复的练习帮助您掌握 Go 的习惯用法。

Go Katas

"I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times."

(Bruce Lee)

What should it be?

  • Go is simple to learn, but nuanced to master. The difference between "working code" and "idiomatic code" often lies in details such as safety, memory efficiency, and concurrency control.

  • This repository is a collection of Daily Katas: small, standalone coding challenges designed to drill specific Go patterns into your muscle memory.

What should it NOT be?

  • This is not intended to teach coding, nor to use Go as a general-purpose learning vehicle. It is not intended to teach Go in general.

  • The focus should be, as much as possible, on challenging oneself to solve common software engineering problems the Go way.

  • Several seasoned developers spend years learning and applying best practices in production-grade contexts. When they decide to switch to Go, they often face two challenges:

    • Is there a way to transfer knowledge so that I don’t have to throw away years of experience and start from zero?

    • If yes, which parts should I focus on to recognize mismatches and use them the expected way in the Go ecosystem?

How to Use This Repo

  1. Pick a Kata: Navigate to any XX-kata-yy folder.
  2. Read the Challenge: Open the README.md inside that folder. It defines the goal, the constraints, and the "idiomatic patterns" you must use.
  3. Solve It: Initialize a module inside the folder and write your solution.
  4. Reflect: Compare your solution with the provided "Reference Implementation" (if available) or the core patterns listed.

Contribution Guidelines

Please refer to the CONTRIBUTING file

Katas Index (Grouped)

01) Context, Cancellation, and Fail-Fast Concurrency

Real-world concurrency patterns that prevent leaks, enforce backpressure, and fail fast under cancellation.

  • 01 - The Fail-Fast Data Aggregator
  • 03 - Graceful Shutdown Server
  • 05 - Context-Aware Error Propagator
  • 07 - The Rate-Limited Fan-Out Client
  • 09 - The Cache Stampede Shield (singleflight TTL)
  • 10 - Worker Pool with Backpressure and errors.Join
  • 14 - The Leak-Free Scheduler
  • 17 - Context-Aware Channel Sender (No Leaked Producers)

02) Performance, Allocation, and Throughput

Drills focused on memory efficiency, allocation control, and high-throughput data paths.

  • 02 - Concurrent Map with Sharded Locks
  • 04 - Zero-Allocation JSON Parser
  • 11 - NDJSON Stream Reader (Long Lines)
  • 12 - sync.Pool Buffer Middleware

03) HTTP and Middleware Engineering

Idiomatic HTTP client/server patterns, middleware composition, and production hygiene.

  • 06 - Interface-Based Middleware Chain
  • 16 - HTTP Client Hygiene Wrapper

04) Errors: Semantics, Wrapping, and Edge Cases

Modern Go error handling: retries, cleanup, wrapping, and infamous pitfalls.

  • 08 - Retry Policy That Respects Context
  • 19 - The Cleanup Chain (defer + LIFO + Error Preservation)
  • 20 - The “nil != nil” Interface Trap (Typed nil Errors)

05) Filesystems, Packaging, and Deployment Ergonomics

Portable binaries, testable filesystem code, and dev/prod parity.

  • 13 - Filesystem-Agnostic Config Loader (io/fs)
  • 18 - embed.FS Dev/Prod Switch

06) Testing and Quality Gates

Idiomatic Go testing: table-driven tests, parallelism, and fuzzing.

  • 15 - Go Test Harness (Subtests, Parallel, Fuzz)

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •This repository is a collection of Daily Katas: small, standalone coding challenges designed to drill specific Go patterns into your muscle memory.
  • •This is not intended to teach coding, nor to use Go as a general-purpose learning vehicle. It is not intended to teach Go in general.
  • •The focus should be, as much as possible, on challenging oneself to solve common software engineering problems the Go way.
  • •Several seasoned developers spend years learning and applying best practices in production-grade contexts. When they decide to switch to Go, they often face two challenges:
  • •Is there a way to transfer knowledge so that I don’t have to throw away years of experience and start from zero?
  • •If yes, which parts should I focus on to recognize mismatches and use them the expected way in the Go ecosystem?
  • •01 - The Fail-Fast Data Aggregator
  • •03 - Graceful Shutdown Server
  • •05 - Context-Aware Error Propagator
  • •07 - The Rate-Limited Fan-Out Client

> 标签

Gogogolanggolang-examples

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言