Skip to content跳到正文
All works全部作品
Code代码

Java to GoJava to Go

A migration-learning platform for Java developers moving to Go — side-by-side code duels, concept mapping, and Go exercises that actually compile.给转 Go 的 Java 开发者做的迁移学习平台——并排代码对决、概念映射,以及真的能编译的 Go 练习。

Stack技术栈
TypeScript · Next.js · React · Tailwind CSS

Written for people who already know Java and Spring and want Go's engineering idioms rather than its syntax table. The premise is that the hard part of the move is not learning for loops — it is un-learning inheritance, checked exceptions and thread pools.

Side by side, not one after the other

The CodeDuel component shows the same business scenario in both languages at once, with linked keyword highlighting between the two panes. Reading Go after Java is harder than reading Go next to Java.

The route follows what actually needs re-wiring:

  1. Types, variables, pointers, strings, collections
  2. Java OOP to Go composition and interfaces
  3. try-catch to explicit error
  4. Threads to goroutines, channels, context
  5. Spring MVC to Gin-style APIs
  6. Connection pools, ORM, explicit transactions
  7. Redis, gRPC, structured logging
  8. Project layout, testing, deployment
  9. A real migration case: an enterprise AI assistant backend

Exercises that compile

/api/run-go proxies to the Go Playground compile endpoint, so exercise code actually runs and its output is checked. The proxy does its own input validation, code-length limits, upstream timeout handling and response-shape checking, so the client never depends on the details of an external service.

Progress lives in localStorage. No accounts, no backend database — a login page is not worth its cost for a learning tool.

MIT.

写给已经懂 Java 和 Spring、想要的是 Go 的工程习惯而不是语法表的人。 前提是:这次转换难的地方不是学 for 循环,而是把继承、受检异常和线程池这些东西忘掉。

并排,而不是先后

CodeDuel 组件把同一个业务场景同时用两种语言展示出来,两栏之间的关键字高亮是联动的。 在读完 Java 之后读 Go,比把 Go 摆在 Java 旁边读要难。

路线按真正需要重新接线的地方走:

  1. 类型、变量、指针、字符串、集合
  2. Java 的 OOP 到 Go 的组合与接口
  3. try-catch 到显式的 error
  4. 线程到 goroutine、channel、context
  5. Spring MVC 到 Gin 风格的 API
  6. 连接池、ORM、显式事务
  7. Redis、gRPC、结构化日志
  8. 项目布局、测试、部署
  9. 一个真实的迁移案例:某企业 AI 助手后端

能编译的练习

/api/run-go 代理到 Go Playground 的编译端点,所以练习代码是真的会跑、输出会被校验的。 这个代理自己做输入校验、代码长度限制、上游超时处理和响应结构检查, 这样客户端就不会依赖某个外部服务的实现细节。

进度存在 localStorage 里。没有账号,没有后端数据库—— 对一个学习工具来说,一个登录页不值这个成本。

MIT。

GoJavaEducationNext.jsGoJava教育Next.js