When testing go files for go Test Coverage, over different packages i run this command -
Command got from this answer code coverage over different packages
go test --cover -covermode=count -coverpkg=./app_test/... ./... -coverprofile=cover.out
but it's giving me [build failed]
After running the command my output is like this -
go build integration-test/app_test/metadata: no non-test Go files in /home/farhad/GoCodes/GPS-server/integration-test/app_test/metadata
go build integration-test/app_test/ping: no non-test Go files in /home/farhad/GoCodes/GPS-server/integration-test/app_test/ping
go build integration-test/app_test/ID: no non-test Go files in /home/farhad/GoCodes/GPS-server/integration-test/app_test/ID
go build integration-test/app_test/history: no non-test Go files in /home/farhad/GoCodes/GPS-server/integration-test/app_test/history
? integration-test [no test files]
FAIL integration-test/app_test/ID [build failed]
? integration-test/app_test/common [no test files]
FAIL integration-test/app_test/history [build failed]
FAIL integration-test/app_test/metadata [build failed]
FAIL integration-test/app_test/ping [build failed]
? integration-test/domain [no test files]
? integration-test/errors [no test files]
FAIL
how to get coverage over different packages?
This is my package structure -
├── app_test
│ ├── common
│ │ └── common.go
│ ├── history
│ │ └── history_test.go
│ ├── ID
│ │ └── id_test.go
│ ├── metadata
│ │ └── metadata_test.go
│ └── ping
│ └── ping_test.go
├── data
│ ├── locations.json
│ └── metadata.json
├── docker-compose.yml
├── Dockerfile
├── domain
│ ├── company.go
│ ├── history.go
│ ├── location.go
│ └── metadata.go
├── errors
│ └── rest_error.go
├── ex.txt
├── go.mod
├── go.sum
├── history_config.local.json
├── id_config.local.json
├── main.go
├── Makefile
├── metadata_config.local.json
├── ping_config.local.json
├── README.md
├── run.sh