bazel-contrib / bazel-contrib/rules_go
Uber's gomock 0.5.0 is incompatible with rules_go's gomock.bzl
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
### What version of rules_go/gazelle/bazel/gomock are you using?
* rules_go 0.50.1 (latest)
* gazelle 0.39.1 (latest)
* bazel 7.3.1 (latest)
* Uber's [gomock 0.5.0](https://pkg.go.dev/go.uber.org/mock/gomock) (latest)
### What happened?
`reflect` mode got dropped, and so the latest release no longer generates a source file that then gets compiled into a binary, which rules_go expects it to do. Instead, a new `package` mode was added, which calls the `go` binary, which is unavailable in the Bazel sandbox.
I tried to modify rules_go to support the new mode but my bazel-fu isn't quite at the level needed for that 😄
### Error
```
ERROR: xxx/BUILD.bazel:15:7: GoMockReflectProgOnlyGen xxx.go failed: (Exit 1): sandbox-exec failed: error executing GoMockReflectProgOnlyGen command
(cd xxx/execroot/_main && \
exec env - \
TMPDIR=xxx/T/ \
/usr/bin/sandbox-exec -f xxx/sandbox.sb xxx/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=xxx/stats.out' /bin/bash -c '
$(pwd)/xxx/mockgen -prog_only xxx xxx > xxx.go
')
2024/10/23 13:49:53 Loading input failed: load package: load packages: err: go command required, not found: exec: "go": executable file not found in $PATH: stderr:
```
Contributor guide
Research direction
Start at the BUILD.bazel target around line 15 and trace the GoMockReflectProgOnlyGen invocation shown in the error. Reproduce the failure with Uber's gomock 0.5.0 in the Bazel sandbox, then compare the available gomock modes and rules_go's expectations. Done means generation succeeds without requiring the go binary in the sandbox.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100