Skip to content

chore: remove go.uber.org/mock dependency#4932

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
Metbcy:chore/remove-go-uber-mock
May 26, 2026
Merged

chore: remove go.uber.org/mock dependency#4932
AkihiroSuda merged 1 commit into
containerd:mainfrom
Metbcy:chore/remove-go-uber-mock

Conversation

@Metbcy
Copy link
Copy Markdown
Contributor

@Metbcy Metbcy commented May 23, 2026

Fixes #3325.

Replaces the generated gomock mocks with small hand-rolled fakes that use function fields, and drops go.uber.org/mock from go.mod / go.sum.

Changes:

  • pkg/infoutil/infoutilmock/infoutil_mock.go: hand-rolled FakeWindowsInfoUtil with RtlGetVersionFunc, GetRegistryStringValueFunc, GetRegistryIntValueFunc fields.
  • pkg/infoutil/infoutil_windows_test.go: switched to the fake.
  • pkg/cmd/builder/build_test.go: replaced the inline gomock-based MockParse with a fakePlatformParser using function fields.
  • go.mod / go.sum: drop go.uber.org/mock v0.6.0.

I went with in-line fakes per the issue text rather than relocating mockgen to a separate package (the alternative @fahedouch raised on the thread); happy to refactor toward that approach instead if preferred.

Verified locally:

  • go build ./...
  • go vet ./...
  • go test ./pkg/cmd/builder/... passes.
  • The Windows test file compiles cleanly under GOOS=windows.
  • grep -r go.uber.org/mock returns no source references.

Replace the generated mocks under pkg/infoutil/infoutilmock and the
inline gomock-based MockParse in pkg/cmd/builder/build_test.go with
hand-rolled fakes that use function fields. This drops the
go.uber.org/mock require from go.mod / go.sum.

Fixes containerd#3325

Signed-off-by: Metbcy <amirbredy1@gmail.com>
@AkihiroSuda AkihiroSuda added this to the v2.3.2 milestone May 25, 2026
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 3b477e8 into containerd:main May 26, 2026
143 of 160 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci e.g., CI failure kind/refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove dependency on go.uber.org/mock

2 participants