In rules_go v0.16.5, go_test targets are not able to access data files in init() functions. I presume this is because whatever changes the working directory does not run until afterwards. However questionable reading files in init() is as a design choice, it does work with the Go command line tool, so seems like it should be supported by rules_go as well.
Here's a reproducer
https://github.com/robfig/go_test_data
In rules_go v0.16.5, go_test targets are not able to access data files in init() functions. I presume this is because whatever changes the working directory does not run until afterwards. However questionable reading files in init() is as a design choice, it does work with the Go command line tool, so seems like it should be supported by rules_go as well.
Here's a reproducer
https://github.com/robfig/go_test_data