1. 14
  1.  

  2. 3

    If you are writing a library, especially one that you intend to be “go get'able”, then I agree with #1. However, if you are writing an application, then I tend to disagree with #1.

    For any non-throwaway app, there usually will come a time where you want to build on a different system than your local laptop/desktop (CI server, end users, etc), or have other developers working with you who need similar environments. I can see the argument for not slowing down the very early gestation period of a project, but I think the few minutes you spend to set up the tooling for a sanitary GOPATH will save you time later by avoiding having to tracking down dependencies and setting up the tooling then, regardless of which tool you use (gb, gpm, godep, etc).

    Note: I have started using gb lately, after previously using gpm (I don’t like godep). I think gb makes vendoring rather nice, even though I tend to dislike vendoring in general (It just feels wrong!). Of course your mileage (and preference in this regard) may vary depending on tooling choice.

    1. 3

      I don’t agree with #3: If there is a new field added to a data type, chances are that I don’t want to initialize it with the nil-value of that type. I strongly prefer my build to fail and be forced to fix it.

      1. 1

        I was going to make exactly that comment yesterday, but I don’t use Go enough to know what situations really commonly arise, so decided against it. But at least if it’s my own structs, I agree with you, if I change a struct, I find the fact that everything touching the struct now yells at me until I update it to be a feature. Where I might go along with the opinion here is with structs defined in standard libraries. Then it might be reasonable behavior for new fields added (by the stdlib authors) to default to whatever they considered to be a reasonable default value, especially if they’re expecting this case and design accordingly.

      2. 2

        Some of these are a toss-up in my opinion, but the explanations make it a worthwhile read. That iota + 1 item seems to come up a lot in gotcha discussions.