1. 3
  1.  

  2. 2

    An equally good alternate approach for avoiding 0-value enums: https://goplay.space/#zUd_xjKl68P

    Also, I disagree with their claim that “there are cases where the default value is clearer when the var keyword is use. Declaring Empty Slices, for example.” I see no reason why one of those is clearer than the other.

    1. 1

      Also, I disagree with their claim that “there are cases where the default value is clearer when the var keyword is use. Declaring Empty Slices, for example.” I see no reason why one of those is clearer than the other.

      Yeah, I don’t think it makes a big difference either 🤷 That being said, s := []int{} is (slightly) different from var s []int, as the former allocates and the latter doesn’t.