Having coded in C*, F#, Java, Groovy, and Python, here are my observations about Go after reading The Way to Go and Go in Action books.

  1. main() function defined in main package serves as the entry point to a Go program.
  2. Each source file can have a init() function that is executed once before main() function in the package.
  3. Types appear after identifiers.
  4. Type aliases are supported.
  5. Go is both strongly and statically typed.
  6. Top-level identifiers with names starting with Capital letters are exported from the containing package. This is true of struct members.
  7. := operator creates and initializes variables.
  8. Multiple variable assignment is supported.
  9. Complex numbers are supported via primitive types.
  10. Strings come in two flavors: interpreted (“”) and raw (‘’).
  11. Pointers (*) and references (&) are supported
  12. Pointer arithmetic is not supported.
  13. Unlike in C or Java, control does not implicitly fall thru between case blocks in a switch statement (unless fallthrough statement is used).
  14. switch statement can decide on both values and types. It can also serve as complex if statement.
  15. for loop comes in three forms: counter-controlled (as usual), condition-controlled (while loops), and enumerative (iterator-based loops).
  16. Like C, break, continue, and goto statements are supported with labels.
  17. Return type of a function appears after the function signature.
  18. Functions are first-class values, i.e., they can be assigned to variables.
  19. Functions support multiple return values and _ is used to ignore values.
  20. Functions support named return variables.
  21. Instead of exceptions, Go has defer, panic, and recover mechanisms (like with statement context managers, raise, and except in Python).
  22. new and make operators are used to allocate memory on heap for value types and reference types, respectively.
  23. Arrays are fixed length sequence of homogeneous values. [Value Type]
  24. Slices are modifiable “views” of arrays that cannot grow beyond the capacity of the underlying array. [Ref Type]
  25. By default, Arrays are passed by value to functions while slices, map, structures, interfaces, and channels are passed by reference.
  26. Argument unpacking (aka splatting) is supported via … operator.
  27. Maps are supported. [Ref Type]
  28. Using arrays, structures, and structs values as keys in maps is a bit tedious (at least for folks coming from Java or C#).
  29. Structs are like structures in C with support to associate methods to them. [Value Type]
  30. Anonymous (no name) fields are supported. This kinda simulates inheritance via embedding (nameless composition).
  31. Functions (aka Methods) can be associated with any type (including function types and primitive types) except interfaces (kinda like extension methods in C#).
  32. Method receiver (this) parameter is explicitly declared like self in Python.
  33. Method and its receiver type should be defined in the same package.
  34. Methods do not carry over to aliases of receiver types.
  35. Types implicitly satisfy interfaces if they implement interface methods (as in structural typing).
  36. It has channels!! It has channels!! It has channels!! :)
  37. Dependency management and build system is a bit archaic and complex when compared to systems such as Maven and Gradle.
  38. Development tools (e.g., formatting, linting, testing, benchmarking) are basic yet well thought out.

Now, for some coding in Go :)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store