Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Small design details I like in Go

Go101 edited this pageSep 23, 2020 ·8 revisions
  1. Go supports usingaValue.Method as a function value without losing theaValue context. This is a so natural feature but I find thatno other popular static languages support it and even some dynamic languages don't support it well.
  2. Go supports declaring methods for any kinds of types
  3. Go supports using different import names to distinguish same-name imported packages.
  4. Except rare dot import style uses, Go forces usingpkg. prefix to reference resources from imported packages.
  5. Many operationson nil valuesdon't cause panics.
  6. Many variations offor loops.
  7. The position of thedefault branch in aswitch orselect code block can be arbitrary.
  8. Go supports declaring types in function bodies.
  9. Go supports nesting function bodies in function bodies.
  10. The type deduction rule for the left untyped operand of a bit-shift operation depends on whether or not the right operand is a constant.
  11. In some scenarios, it is ok to use array pointers as arrays.
  12. Go disallows cyclic imports.
  13. v++ andv-- can only be used as statements.
  14. non-boolean values can't be used as booleans.

Please follow the official Twitter account ofGo 101,@zigo_101, to learn some Go details, facts, tips, etc, and read some Go articles from time to time.

Go 101 is a series of books about Go programming.

Books inGo 101 series

Tapir started writing the Go 101 books and maintaining thego101.org website since 2016. New contents will continue being added to the books and the website from time to time. If you would like to, you can also supportGo 101 byplaying Tapir's games (for both Android and iPhone/iPad):

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp