1. 16
  1.  

  2. 7

    Interesting, but I have a small nitpick. GetLatestArticles and GetAuthors are unidiomatic.

    it’s neither idiomatic nor necessary to put Get into the getter’s name.

    https://golang.org/doc/effective_go.html#Getters

    1. 8

      I think for things that aren’t just “return the field” (which that doc is referring to), especially things that may reference a database, cache, external API, etc., the Get prefix is sensible and gives you context that some kind of fetch is actually happening.

      1. 1

        Thanks, I didn’t know this. I think I’ll use this pattern across other codebases.

      2. 2

        Great article! Although this link was posted here before. Here’s the discussion on this topic from around a month ago.

        1. 4

          Since the article was written (and discussed), Golang switched to using [] for generics, which is the correct choice.

          1. 1

            Oh, I missed it when it was posted the first time! It seemed strange that Lobsters didn’t warn me that the article was already posted, given that it’s just a popular topic.

            1. 1

              So I figured that the other post contains a different link that resolves to the same URL. I’ve added a comment on the GitHub issue for this.