1. 5
  1. 2

    The use of anonymous structs in table driven tests is really what made me enjoy writing tests in go. I’ve tried to replicate similar patterns in java/junit but it looks a little too verbose according to my co-workers…

    1. 1

      There is a typo (missing struct):

      type ServerOpts {
          Port int // default it to defaultPort somewhere                                                      

      Also I have a question here. Another article/talks mentions that such config structs are an anti-pattern. So which one is true or in which cases would it be chose. Personally I am currently going with (exported) Default* variables in cases where something like this makes sense - in a similar way to the Go standard library.