Skip to content

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

Open
Metbcy wants to merge 1 commit into
containerd:mainfrom
Metbcy:chore/remove-go-uber-mock
Open

chore: remove go.uber.org/mock dependency#4932
Metbcy wants to merge 1 commit into
containerd:mainfrom
Metbcy:chore/remove-go-uber-mock

Conversation

@Metbcy
Copy link
Copy Markdown

@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove dependency on go.uber.org/mock

1 participant