Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: wrong print msg when comparing initialized and uninitialized slice #79

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

k3forx
Copy link
Contributor

@k3forx k3forx commented Sep 10, 2023

Issue

close: #69

Tests

I checked all tests are passed with go version 1.19.5 and 1.20.3

  • 1.19.5
❯ go version
go version go1.19.5 darwin/amd64

❯ go test ./...
ok      go.uber.org/mock/gomock 0.998s
?       go.uber.org/mock/gomock/internal/mock_gomock    [no test files]
ok      go.uber.org/mock/mockgen        1.488s
?       go.uber.org/mock/mockgen/internal/tests/add_generate_directive  [no test files]
ok      go.uber.org/mock/mockgen/internal/tests/aux_imports_embedded_interface  0.411s
?       go.uber.org/mock/mockgen/internal/tests/aux_imports_embedded_interface/faux     [no test files]
?       go.uber.org/mock/mockgen/internal/tests/const_array_length      [no test files]
?       go.uber.org/mock/mockgen/internal/tests/copyright_file  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/custom_package_name/client/v1   [no test files]
ok      go.uber.org/mock/mockgen/internal/tests/custom_package_name/greeter     0.668s
?       go.uber.org/mock/mockgen/internal/tests/custom_package_name/validator   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/defined_import_local_name       [no test files]
?       go.uber.org/mock/mockgen/internal/tests/dot_imports     [no test files]
?       go.uber.org/mock/mockgen/internal/tests/empty_interface [no test files]
?       go.uber.org/mock/mockgen/internal/tests/extra_import    [no test files]
ok      go.uber.org/mock/mockgen/internal/tests/generated_identifier_conflict   0.754s
ok      go.uber.org/mock/mockgen/internal/tests/import_embedded_interface       0.370s
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/ersatz        [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/faux  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/other/ersatz  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/other/log     [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_source   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_source/definition        [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg    [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg        [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/reflect_output [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/missing_import/output   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/missing_import/source   [no test files]
ok      go.uber.org/mock/mockgen/internal/tests/mock_in_test_package    1.160s [no tests to run]
ok      go.uber.org/mock/mockgen/internal/tests/overlapping_methods     1.379s
ok      go.uber.org/mock/mockgen/internal/tests/panicing_test   1.528s [no tests to run]
?       go.uber.org/mock/mockgen/internal/tests/parenthesized_parameter_type    [no test files]
?       go.uber.org/mock/mockgen/internal/tests/performance/big_interface       [no test files]
?       go.uber.org/mock/mockgen/internal/tests/self_package    [no test files]
ok      go.uber.org/mock/mockgen/internal/tests/test_package    1.715s [no tests to run]
ok      go.uber.org/mock/mockgen/internal/tests/unexported_method       1.911s
?       go.uber.org/mock/mockgen/internal/tests/vendor_dep      [no test files]
?       go.uber.org/mock/mockgen/internal/tests/vendor_dep/source_mock_package  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/vendor_pkg      [no test files]
ok      go.uber.org/mock/mockgen/model  2.080s
ok      go.uber.org/mock/sample 0.589s
ok      go.uber.org/mock/sample/concurrent      2.245s
?       go.uber.org/mock/sample/concurrent/mock [no test files]
?       go.uber.org/mock/sample/imp1    [no test files]
?       go.uber.org/mock/sample/imp2    [no test files]
?       go.uber.org/mock/sample/imp3    [no test files]
?       go.uber.org/mock/sample/imp4    [no test files]
  • 1.20.3
❯ go version
go version go1.20.3 darwin/amd64

❯ go test ./...
?       go.uber.org/mock/gomock/internal/mock_gomock    [no test files]
ok      go.uber.org/mock/gomock 0.308s
?       go.uber.org/mock/mockgen/internal/tests/add_generate_directive  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/aux_imports_embedded_interface/faux     [no test files]
?       go.uber.org/mock/mockgen/internal/tests/const_array_length      [no test files]
?       go.uber.org/mock/mockgen/internal/tests/copyright_file  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/custom_package_name/client/v1   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/custom_package_name/validator   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/defined_import_local_name       [no test files]
?       go.uber.org/mock/mockgen/internal/tests/dot_imports     [no test files]
?       go.uber.org/mock/mockgen/internal/tests/empty_interface [no test files]
?       go.uber.org/mock/mockgen/internal/tests/extra_import    [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/ersatz        [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/faux  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/other/ersatz  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_embedded_interface/other/log     [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_source   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/import_source/definition        [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg    [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg        [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/reflect_output [no test files]
?       go.uber.org/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/missing_import/output   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/missing_import/source   [no test files]
?       go.uber.org/mock/mockgen/internal/tests/parenthesized_parameter_type    [no test files]
?       go.uber.org/mock/mockgen/internal/tests/performance/big_interface       [no test files]
?       go.uber.org/mock/mockgen/internal/tests/self_package    [no test files]
?       go.uber.org/mock/mockgen/internal/tests/vendor_dep      [no test files]
?       go.uber.org/mock/mockgen/internal/tests/vendor_dep/source_mock_package  [no test files]
?       go.uber.org/mock/mockgen/internal/tests/vendor_pkg      [no test files]
?       go.uber.org/mock/sample/concurrent/mock [no test files]
?       go.uber.org/mock/sample/imp1    [no test files]
?       go.uber.org/mock/sample/imp2    [no test files]
?       go.uber.org/mock/sample/imp3    [no test files]
?       go.uber.org/mock/sample/imp4    [no test files]
ok      go.uber.org/mock/mockgen        0.992s
ok      go.uber.org/mock/mockgen/internal/tests/aux_imports_embedded_interface  0.541s
ok      go.uber.org/mock/mockgen/internal/tests/custom_package_name/greeter     0.424s
ok      go.uber.org/mock/mockgen/internal/tests/generated_identifier_conflict   0.641s
ok      go.uber.org/mock/mockgen/internal/tests/import_embedded_interface       0.813s
ok      go.uber.org/mock/mockgen/internal/tests/mock_in_test_package    0.676s [no tests to run]
ok      go.uber.org/mock/mockgen/internal/tests/overlapping_methods     0.798s
ok      go.uber.org/mock/mockgen/internal/tests/panicing_test   0.857s [no tests to run]
ok      go.uber.org/mock/mockgen/internal/tests/test_package    0.935s [no tests to run]
ok      go.uber.org/mock/mockgen/internal/tests/unexported_method       1.017s
ok      go.uber.org/mock/mockgen/model  0.996s
ok      go.uber.org/mock/sample 1.071s
ok      go.uber.org/mock/sample/concurrent      1.108s

@JacobOaks
Copy link
Contributor

Hey, thanks for the PR and sorry for the delay in response.

We think this is a good idea in general, but we're worried about the extra verbosity.
Do you think we should instead check for the specific edge case when printing, and only use the formatting directive then?

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.

Wrong print msg when comparing initialized and uninitialized slice
2 participants