mercredi 14 novembre 2018

Go test fails to run due to a resource file not available

I'm pretty new to Golang and testing with Go, so go easy on me :)

I have a Go project, really simple with some Go files and some test files. All of my test files are ending with _test.go. All of my test were running fine, until I modified a non test file, where I suppose to load an URL from an external file.

As I don't want to use that external file for my tests, I'm moking the URL without the necessity to read the file. And here comes to point that I cannot understand.

When launching go test it does not even run my tests, my program is panicking as it cannot find the external file. So go test should not only execute tests from go files marked with _test? If I comment the line of code that panics, all tests are running fine, so I'm a little bit confused.

Can anyone help me to understand this situation? I'm running the latest stable version of GO.

Thanks!

Aucun commentaire:

Enregistrer un commentaire