Skip to content

CNF-23390: mockgen deprecated: use uber-go/mock instead#125

Open
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:mockgen_deprecation
Open

CNF-23390: mockgen deprecated: use uber-go/mock instead#125
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:mockgen_deprecation

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Nov 13, 2025

Copy link
Copy Markdown
Member

https://github.com/golang/mock is marked as archived as of June 27, 2023. They recommend using go.uber.org/mock.

This PR attempts to change the dependency to one that is maintained.

Tracking issue: redhat-best-practices-for-k8s/telco-bot#45

Summary by CodeRabbit

  • Chores
    • Updated mock-generation tooling to use a newer mocking library version, improving development/build compatibility.
    • Adjusted the tooling configuration for mock generation under the build-tagged utilities.
    • No changes to runtime behavior or end-user functionality; impact is limited to internal testing and developer workflows.

@openshift-ci

openshift-ci Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nrb for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 1b706cf to c21c427 Compare March 20, 2026 19:44
@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 29d694b0-8ab0-4605-bcec-9e1012dfff35

📥 Commits

Reviewing files that changed from the base of the PR and between e1e556d and 32a1c22.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod
  • tools/tools.go
✅ Files skipped from review due to trivial changes (1)
  • tools/tools.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • go.mod

Walkthrough

Replace the mock dependency from github.com/golang/mock v1.6.0 with go.uber.org/mock v0.5.0 and update the tools blank import to use go.uber.org/mock/mockgen.

Changes

Mock library migration

Layer / File(s) Summary
Dependency declaration
go.mod
Removed github.com/golang/mock v1.6.0 from the main require block and added go.uber.org/mock v0.5.0 as a direct require.
Tool import wiring
tools/tools.go
Tool blank import switched from github.com/golang/mock/mockgen to go.uber.org/mock/mockgen under the tools build tag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ipv6 And Disconnected Network Test Compatibility ⚠️ Warning PR adds Ginkgo test files with hardcoded IPv4 addresses (10.40.42.15, 10.40.131.30, 10.40.42.5, 10.40.42.6) that would fail in IPv6-only disconnected environments. Replace hardcoded IPv4 addresses with dynamic IP family detection using GetIPAddressFamily() or adapt tests for both IPv4/IPv6 using correctCIDRFamily() helper.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: replacing the deprecated golang/mock with uber-go/mock, which is the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR only modifies go.mod and tools/tools.go (dependency updates), not any test files. No Ginkgo test names were changed or added, so the test name stability check does not apply.
Test Structure And Quality ✅ Passed This PR only updates dependencies (go.mod) and build tool imports (tools/tools.go) to replace deprecated golang/mock with maintained go.uber.org/mock. It does not modify, add, or change any Ginkgo...
Microshift Test Compatibility ✅ Passed This PR only updates build tool dependencies (golang/mock → go.uber.org/mock) in go.mod and tools/tools.go. It adds no new Ginkgo e2e tests, so the MicroShift Test Compatibility check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only updates dependencies (golang/mock to go.uber.org/mock) in go.mod and tools/tools.go. No new Ginkgo e2e tests are added; check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only build-time dependencies (go.mod) and build tools (tools/tools.go). No deployment manifests, operator code, or controllers with scheduling constraints are modified, making the topol...
Ote Binary Stdout Contract ✅ Passed This is a machine-api-provider (controller), not an OTE binary. The PR only changes build-time mock dependencies in go.mod and tools/tools.go, with no stdout writes introduced or modified in the bi...
No-Weak-Crypto ✅ Passed PR replaces archived golang/mock with maintained go.uber.org/mock dependency in go.mod and tools/tools.go. No weak cryptographic patterns (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto i...
Container-Privileges ✅ Passed PR changes only dependency versions (golang/mock to uber-go/mock) in go.mod and tools/tools.go. No container/K8s manifests modified, and existing manifests have no privileged settings.
No-Sensitive-Data-In-Logs ✅ Passed PR only modifies dependencies (go.mod) and blank imports (tools/tools.go); no logging code that could expose sensitive data is added or modified.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@sebrandon1 sebrandon1 changed the title mockgen deprecated: use uber-go/mock instead CNF-23390: mockgen deprecated: use uber-go/mock instead Apr 30, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 30, 2026
@openshift-ci-robot

openshift-ci-robot commented Apr 30, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNF-23390 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

https://github.com/golang/mock is marked as archived as of June 27, 2023. They recommend using go.uber.org/mock.

This PR attempts to change the dependency to one that is maintained.

Tracking issue: redhat-best-practices-for-k8s/telco-bot#45

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 30, 2026
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from c21c427 to 7b70646 Compare May 6, 2026 13:15
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 6, 2026
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 7b70646 to e1e556d Compare June 9, 2026 16:35
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from e1e556d to 32a1c22 Compare June 18, 2026 17:36
@perdasilva

Copy link
Copy Markdown

/retest

@perdasilva

Copy link
Copy Markdown

@sebrandon1 this has been open for a little while now, is it still relevant?

@openshift-ci

openshift-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-e2e-aws-ovn 1b7522d link false /test okd-scos-e2e-aws-ovn
ci/prow/regression-clusterinfra-nutanix-ipi-mapi 32a1c22 link false /test regression-clusterinfra-nutanix-ipi-mapi

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants