DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DΓͺnis Mendes
DΓͺnis Mendes

Posted on

Running Golang tests in docker container

Hi there!

I was trying to run a test with golang running in a docker container and I was stumbling into that message:

[no tests to run]

I figured out doing like that:

docker exec docker_golang_service_1 go test -run ./... golangservice.com/v1/src/tests

Explaining:

docker exec YOUR_CONTAINER_NAME go test -run ./... YOUR_MODULE_NAME+PATH_TO_YOUR_TEST_DIRECTORY

The ./... means running every test exist into directory.

That's it.

Top comments (0)

Become a Moderator Do you want us to help make DEV a better place?

Fill out this survey and help us by becoming a tag moderator here at DEV.