At the moment, the best practice for this is to have a directory that can be added to your GOPATH. So basically, have a src directory in your repository root, or somewhere deeper, but all the Go code would be under src. Until tools are aware of Bazel, the best thing to do is to show them something that fits in GOPATH. This works in most cases, but generated Go code won't be visible, since Bazel stores that separately in the build cache.
If you're using Gazelle, you can make sure it gets the import paths right by adding this comment to src/BUILD.bazel:
# gazelle:prefix
This sets the empty prefix at src. Libraries defined below that will have their importpath set to the relative path from src/. So for example, src/
github.com/foo/bar will have the importpath
github.com/foo/bar.
You originally asked about go_path. This may be useful if you have a tool which you want to invoke through Bazel that only understands GOPATH. I don't have a complete example for you at the moment, but you might find the
go_path test package useful. go_path won't be useful for interactive tools such as godef, goimports, gocode, gorename, or guru.
Long term, the Go Tools team is working on an abstraction layer between tools and build systems. This is driven by the need to support vgo, which doesn't require GOPATH. Bazel and other Go build systems will also benefit from this. This is our highest priority project right now, but getting the API right and supporting current tools and build systems is a lot of work, so it will take some time. We don't have anything public yet, but I expect we will soon.