Can anyone explain me why I should attempt to do this? The below works for a single package only.
func TestMain(m *testing.M) { setup() exitVal := m.Run() teardown() os.Exit(exitVal)} func setup() { flag.StringVar(&util.ServerFlag, "server", "s", "server to set request for") flag.Parse() viper.SetDefault("testing", true) util.BasicStart() iot.RunDependencies() cats.SyncS3() router := cmd.InitRootRouter() util.SetTestServer(httptest.NewServer(router))} func teardown() { log.Println("[TESTS] - Teardown completed") } But I was expecting to place to keep the tests inside each package. src/backend/├── cats│ ├── cat_test.go // packaget cat_test│ ├── handler.go // package cat│ ├── routes.go│ └── tools.go├── cmd│ ├── populate.go│ ├── root.go│ └── runserver.go├── iot│ └── device│ ├── all.go // packaget device_test │ ├── all_test.go // packaget device_test│ ├── router.go│ ├── types.go│ └── update.go├── main.go├── main_test.go //package main_test└── root_test.go //package main -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.