Skip to content

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

Open
sebrandon1 wants to merge 1 commit intoopenshift:mainfrom
sebrandon1:mockgen_deprecation
Open

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

Conversation

@sebrandon1
Copy link
Copy Markdown
Member

@sebrandon1 sebrandon1 commented Nov 13, 2025

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 dependencies for internal testing and mock generation tools

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Nov 13, 2025

[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
Copy link
Copy Markdown

coderabbitai Bot commented Mar 20, 2026

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: fd1b4437-c970-4122-9896-e50a3baceb07

📥 Commits

Reviewing files that changed from the base of the PR and between c21c427 and 7b70646.

⛔ Files ignored due to path filters (4)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/golang/mock/CONTRIBUTORS is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/golang/mock/mockgen/reflect.go is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/golang/mock/mockgen/version.1.11.go is excluded by !**/vendor/**, !vendor/**
📒 Files selected for processing (2)
  • go.mod
  • tools/tools.go

Walkthrough

Replaces the mock dependency from github.com/golang/mock v1.6.0 to go.uber.org/mock v0.6.0, updating the go.mod requirement and the tools import in tools/tools.go.

Changes

Mock library migration

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

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Test assertions lack meaningful failure messages. No assertions include descriptive messages as second parameter. Non-idiomatic test patterns in machine tests (TestMain instead of Ginkgo hooks). Add failure messages to all assertions using second parameter. Refactor machine tests to use Ginkgo Describe/BeforeEach/AfterEach for consistency.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: migrating from the deprecated golang/mock to uber-go/mock, which is the core objective of the pull request.
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 This PR only changes dependencies (go.mod and tools/tools.go) and does not modify any test files. No Ginkgo test names are affected. The check is not applicable to this PR.
Microshift Test Compatibility ✅ Passed MicroShift Test Compatibility check is not applicable. This PR updates mock library dependencies (golang/mock → uber-go/mock) without adding any new Ginkgo e2e tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR does not add any new Ginkgo e2e tests. Changes are only dependency updates (go.mod) and build tool imports (tools/tools.go). The SNO compatibility check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only build tooling (mock library in go.mod/tools.go). No deployment, operator code, or controller scheduling changes. Check for topology-aware scheduling constraints does not apply.
Ote Binary Stdout Contract ✅ Passed Dependency swap from golang/mock to go.uber.org/mock in build-time tools only. No production code or stdout changes. Existing klog configuration unaffected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests are added in this PR. The changes are limited to updating mock dependencies (golang/mock → go.uber.org/mock) in go.mod and tools/tools.go. The custom check does not apply.

✏️ 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.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 20, 2026

@sebrandon1: The following test 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

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.

@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
Copy link
Copy Markdown

openshift-ci-robot commented Apr 30, 2026

@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
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.

2 participants