When I write tests in Go that require static files (for example, the hello.txt file, where do I test my program that hello.txt reads), where should I put the static files? How should I access them in a test file?
That is, currently my installation is a local directory, GOPATH installed in this directory. There I have
src/ mypkg/ myfile.go myfile_test.go testfiles/ hello.txt world.txt
Now in myfile_test.go I do not want to use the absolute path to link to testfiles/hello.txt . Is there any idiomatic way to do this?
Is this a reasonable layout?
source share