How to run all tests in a Go project with `go test`?
Hi everyone! I'm new to Go and trying to figure out testing. I have a project with several packages, and each has its own test files (e.g., `main_test.go`, `utils_test.go`, `api_test.go`). I want to run all tests in the entire project with a single command, but I don't understand how to do it correctly.
I tried different options: `go test`, `go test ./...`, but the results are different. Sometimes tests don't run at all, sometimes only in the current directory. Here's an example of my project structure:
```
myproject/
├── main.go
├── main_test.go
├── utils/
│ ├── helpers.go
│ └── helpers_test.go
└── api/
├── handlers.go
└── handlers_test.go
```
When I'm in the project root and type `go test`, only tests from `main_test.go` run, and tests in subfolders `utils`
No answers yet.
Log in to leave an answer