Go 应该更有主见。

  • About the Author: The author is a Google Developer Expert and has been writing code in Go for 10 years.
  • Meeting with Go Creators: A few weeks ago, the author met [Robert Griesemer] (co-creator of Go) and [Marc Dougherty] (Developer Advocate for the Go team at Google) at a Google I/O happy hour and was asked for feedback on the language.
  • Initial Impression of Go: When starting with Go, it was easy to learn due to its simplicity and having only one way to do things. This made code reading easier and the author's code was similar to Kubernetes code.
  • Challenge in Larger Projects: After the initial excitement, the biggest challenge is adopting Go in larger projects. Each team or company needs to decide how to structure their projects as the language doesn't have strong opinions at this stage. The author's current company has created a document about this.
  • Analogy with Games: It's like moving from the controlled world of Super Mario World to the open world of GTA 6. The transition is abrupt.
  • Suggestion for Go: Go could be more opinionated about application layout by providing templates for common projects like CLIs, APIs, and microservices. The language toolkit already allows project templates, so having official ones would be helpful. Or, including a command like go new in the toolkit.
  • Similar Event in Language History: The go mod dependency management was not always official. The community developed alternatives until the language team took control and created go mod. The same approach could be applied to project structure.
  • Benefit for Migrating Teams: Teams migrating from other languages like Java and PHP would benefit from a more opinionated project structure. It would lower the entry barrier and increase the number of teams using Go in production.
阅读 16
0 条评论