1. 18
  1.  

  2. 5
    • you can shorten Add’s parameters list as: (x, y int)
    • did you consider maybe explaining in the article/chapter why you wrote main with small ‘m’, but Add with capital ‘A’? or actually changing the latter to start with small letter as well?
    1. 5
      1. Yeah, I intentionally wanted it to be verbose so it would be easier to understand.
      2. That’s a good point. I’ll go edit that. Thanks!
    2. 2

      This is similar to what I cover (starting on slide 21) in these slides I created for a session I taught recently: https://docs.google.com/presentation/d/1KTzbHNmbL9BNYJLNLlQavWPMdJflcwVxa57tlEg-aGk/edit#slide=id.g3782c86138_0_217

      1. 1

        Note you can do this too:

        package main
        func main() {
           println("sun mon tue")
        }
        

        https://golang.org/pkg/builtin#println

        1. 5

          I’m aware, but IIRC that builtin is something that’s not guaranteed to be in future releases of Go. I want to teach people forward-compatible Go as much as possible.

          1. 3

            I think fmt makes for a really great introduction to the notion of “importing” code, as it provides functionality even non-programmers can appreciate, and is just as built-in as println. I don’t see how getting rid of the import would necessarily speed up the user’s first code writing experience, or impart upon them a greater understanding.