jmhodges / bazel_gomock

Code to create Go mocks for bazel targets using mockgen
MIT License
59 stars 29 forks source link

Removing GOPATH in source mode #44

Closed linzhp closed 2 years ago

linzhp commented 4 years ago

After https://github.com/golang/mock/pull/420, GoMock source mode no longer requires full transitive dependency closure in GOPATH. As a result, the gomock rule can avoid calling the gopath rule, it only need to make sure the source file and auxiliary files in the GOPATH.

When building //gomock:mocks from https://github.com/linzhp/bazel_examples/commit/b7f4b75098d22e604540a87e4eaa3877de46aa9d, bazel_gomock (4f2ee840432b1a08ccc46ee4f2c1f5a2bad8fade) spent 2.287 seconds on gomock rule:

     538 ms    5.71%   action 'GoPath gomock/mocks_gomock_gopath'
    1.749 s   18.57%   action 'Action gomock/mocks.go'

After applying this patch, it became 1.498 seconds:

    1.498 s   20.77%   action 'Action gomock/mocks.go'

The difference would be more significant for packages with large dependency tree

linzhp commented 4 years ago

@jmhodges I updated the performance comparison data. Please review.

linzhp commented 3 years ago

@jmhodges Can you take another look at this PR?

linzhp commented 3 years ago

@jmhodges ping...

linzhp commented 2 years ago

Superseded by https://github.com/bazelbuild/rules_go/pull/3121