bazel-contrib / bazel-contrib/rules_go
Allow `Rlocation()` also for existing folders
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
### What version of rules_go are you using?
0.50.1
### What version of gazelle are you using?
0.39.1
### What version of Bazel are you using?
7.0.2
### Does this issue reproduce with the latest releases of all the above?
### What operating system and processor architecture are you using?
Linux
### Any other potentially useful information about your toolchain?
### What did you do?
```go
r, err := runfiles.New()
if err != nil {
return "", err
}
repoBasePath, err := r.Rlocation("my_repo")
repoBasePath, err = r.Rlocation("my_repo/my_pkg")
```
### What did you expect to see?
The previous snippet should succeed without error and return the runfiles path for `my_repo` or `my_repo/my_pkg`.
### What did you see instead?
The call to `Rlocation()` returnes an error for runfiles paths like directories which are not files. This works in the runfiles implementation of other programming languages like C++:
```cpp
repoBasePath = Runfiles::Create("")->Rlocation("my_repo");
repoBasePath = Runfiles::Create("")->Rlocation("my_repo/my_pkg");
```
Contributor guide
Research direction
Start at the Go runfiles implementation of Rlocation() and run the reported snippet with existing repository and package directories. Compare its behavior with the C++ example in the issue; done means Rlocation("my_repo") and Rlocation("my_repo/my_pkg") return their runfiles paths without errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100