# Golang

# Preferred packages

  • Routing https://github.com/gorilla/mux.
  • Working with dotenv files https://github.com/caarlos0/env and https://github.com/joho/godotenv.
  • Asserts lib https://godoc.org/github.com/stretchr/testify/assert.
  • Mocks https://godoc.org/github.com/stretchr/testify/mock.

# Test naming convention

The test function name follows the format of Test + the name of the package where the function is placed, with the function name appended after an underscore (_). For example, the Server.Debug.Enable() function is tested in the TestServer_DebugEnable test function. Similarly, the Server.SetupConfig is tested in TestServer_SetupConfig test function.

There are functions like Server.Config() that require more specific tests. That’s why, for example there are TestServer_Config and TestServer_ConfigWithSpecialContext, where in the latter there is more specific functionality being tested.

func TestServer_Config(t *testing.T) {
    ...
}

func TestServer_ConfigWithSpecialContext(t *testing.T) {
    ...
}