Skip to content

Commit

Permalink
NO-ISSUE: Update Dockerfile to use go.uber.org/mock (#911)
Browse files Browse the repository at this point in the history
The change to use `go.uber.org/mock` instead of the deprecated
`github.com/golang/mock` was was mostly done in the past. But the
_Dockerfile_ wasn't updated to use the new `mockgen` command.  As a
result if one installs the `mockgen` with the command from the
dockerfile and then runs `make generate` the resulting code doesn't
build:

```
$ grep mockgen Dockerfile.assisted-installer-build
  go install github.com/golang/mock/[email protected] && \

$ go install github.com/golang/mock/[email protected]

$ make generate
go generate ..
make format
make[1]: Entering directory '/files/projects/assisted-installer/repository'
make[1]: Leaving directory '/files/projects/assisted-installer/repository'

$ make build
CGO_ENABLED=0  go build -o build/installer src/main/main.go
src/main/drymock/dry_mode_k8s_mock.go:308:36: cannot use mockController (variable of type *"go.uber.org/mock/gomock".Controller) as *"github.com/golang/mock/gomock".Controller value in argument to k8s_client.NewMockK8SClient
make: *** [Makefile:68: installer] Error 1
```

To avoid this issue this patch updates the _Dockerfile_ to use the
`go.uber.org/mock` package.

There are also some minor white space changes introduced by running `go
generate`.

Signed-off-by: Juan Hernandez <[email protected]>
  • Loading branch information
jhernand authored and adriengentil committed Dec 20, 2024
1 parent 77f6881 commit 5fb31e8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile.assisted-installer-build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV GOFLAGS=""
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2 && \
go install golang.org/x/tools/cmd/[email protected] && \
go install github.com/onsi/ginkgo/[email protected] && \
go install github.com/golang/mock/mockgen@v1.6.0 && \
go install go.uber.org/mock/mockgen@v0.4.0 && \
go install gotest.tools/[email protected] && \
go install github.com/axw/gocov/[email protected] && \
go install github.com/AlekSi/[email protected]
Expand Down
1 change: 1 addition & 0 deletions src/assisted_installer_controller/mock_reboots_notifier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/ignition/mock_ignition.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/inventory_client/mock_inventory_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/k8s_client/mock_k8s_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/ops/execute/mock_execute.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/ops/mock_ops.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5fb31e8

Please sign in to comment.