bazel-contrib / bazel-contrib/rules_go
nogo patches doesn't seem to account for `symlink_prefix`
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
It seems that this feature (added in https://github.com/bazel-contrib/rules_go/pull/4102) does not account for `build --symlink_prefix=`.
My `.bazelrc` says:
```
build --symlink_prefix=.bazel/
```
Upon build, I get this:
```
nogo: errors found by nogo during build-time code analysis:
go/core/utils.go:716:8: Use len(x) == 0 rather than x == "": s == "" (empty_string_check)
-------------------Suggested Fix---------------------
--- a/go/core/utils.go
+++ b/go/core/utils.go
@@ -713,7 +713,7 @@
}
func TestRulesGo(s string) string {
- if s == "" {
+ if len(s) == 0 {
return "{}"
}
return s
-----------------------------------------------------
To apply the suggested fix, run the following command:
$ patch -p1 < bazel-out/darwin_arm64-fastbuild/bin/go/core/core.nogo.patch
```
This is not quite right given the path is invalid: nogo reports `bazel-out/darwin_arm64-fastbuild/bin/go/core/core.nogo.patch` when the correct path is `.bazel/out/darwin_arm64-fastbuild/bin/go/core/core.nogo.patch`. Is `rules_go` not properly accounting for symlinks?
Environment facts:
1. `Build label: 7.4.1`
2. Go version 1.23
3. `rules_go` version `v0.53.0`
4. `gazelle` version `v0.35.0`
Contributor guide
Research direction
Reproduce the build using the `.bazelrc` setting `build --symlink_prefix=.bazel/` and the reported `go/core/core.nogo.patch` output. Compare the reported `bazel-out/...` path with the expected `.bazel/out/...` path, and review the symlink_prefix feature introduced in pull request 4102. Done means nogo reports a patch path that works with the configured prefix.
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