rules_go icon indicating copy to clipboard operation
rules_go copied to clipboard

Provide an implementation of io/fs for accessing runfiles

Open tomqwpl opened this issue 2 years ago • 1 comments

This is a suggested enhancement.

Runfiles on Windows don't work at all naturally unless you turn on Windows symlinks. Windows symlinks are expensive to create, runfiles can create a lot of them, so even turning on symlinks doesn't seem without issues.

Instead it seems like you are supposed to use the github.com/bazelbuild/rules_go/go/tools/bazel package to access runfiles. Trouble is that this then couples my tests to bazel.

An improvement would seem to be to provide an implementation of io/fs for accessing the runfiles. I could at least then abstract things and test code that is designed to work with an ordinary filesystem. I could list the contents of the directory, things like that.

My discovery of the runfiles behavior on Windows is close to being a dealbreaker for using bazel. I wouldn't expect to have to change my code just because I'm changing the build system I use.

tomqwpl avatar Jul 03 '22 06:07 tomqwpl

That sounds like a really great enhancement to the run files feature. What can I do to help you put together a pull request to start a more specific conversation around this topic?

achew22 avatar Jul 03 '22 17:07 achew22