dimanche 4 novembre 2018

Relative path in tests [duplicate]

This question already has an answer here:

While testing my code I've faced the following problem:
My file lays in the directory with .go file. So, I'm getting path to it this way:

ex, _ = os.Executable()
dir = filepath.Dir(ex)
fileURI     = dir + "/dataset.xml"

And here what I get: /tmp/go-build355762287/b001/dataset.xml Obviously, it's not what I want. So the question is how to test it properly.

Aucun commentaire:

Enregistrer un commentaire