How to run all tests in a Go project (go test) and not miss any?
Hello, colleagues! I've just started learning Go and am trying to figure out testing. I have a small project with this structure:
```
myproject/
├── main.go
├── go.mod
├── pkg/
│ ├── calc/
│ │ ├── calc.go
│ │ └── calc_test.go
│ └── utils/
│ ├── strings.go
│ └── strings_test.go
└── tests/
└── integration_test.go
```
When I'm in the project root and run `go test`, it only runs tests from the current folder (where main.go is), and tests in subfolders `pkg/` and `tests/` are ignored. I tried running `go test ./...`, but then it complains that it cannot find some files, especially in `tests/`. What am I doing wrong? How do I correctly run all project tests with a single command? Do I need to configure `go.mod` or the structure in some special way?
No answers yet.
Log in to leave an answer