opened
jayconrod
username_0
In the rest of the Bazel world, tests run in a sandbox which is logically similar to the project's root directory.

In the Go world, `go test` runs tests in their package directory.

In this set of rules `go_test` runs in a sandbox logically similar to the Bazel package where the test is declared.

We should provide a mechanism to support both the Bazel and Go conventions. We want to be able to import and test non-Bazel Go projects, but we also don't want to surprise people who are used to the way Bazel works with other languages.

I propose adding a `rundir` attribute to the `go_test` rule which would provide some control. By default, this would be the project root directory (following Bazel convention). By default, Gazelle would set this to be the Go package directory, so that imported tests continue to work.

cc @username_1 @rosun82
Add options to go_test for controlling working directory
issue
created
pmbethe09
username_1
That sounds like a good plan.  gazelle should add 'test_style = "Go"', or whatever the flag look like, but leave alone any pre-existing go_test.
comment
closed
jayconrod
username_0
issue
created
jayconrod
username_0
Duplicate of #162
comment