-
Notifications
You must be signed in to change notification settings - Fork 606
Conversation
@codyoss I will add tests if the overall approach looks good to you |
Thanks for the PR, I probably won't have time to look at this today, but will try to get to it tomorrow. Thanks for being an active member in the community 😄 |
The travis-ci is failing even all tests are passing. |
6.19s$ ./ci/check_go_generate.sh
prog.go:14:2: use of internal package github.com/golang/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg not allowed |
return "", err | ||
moduleMode := os.Getenv("GO111MODULE") | ||
// trying to find the module | ||
if moduleMode != "off" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is auto
a special case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth being explicit /w a switch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the meaning of auto
changes from Go release to release. To be safe, I only skip checking go.mod
when the mode is "off". This may result in different behavior than "go list" in older Go releases.
For example, when "GO111MODULE" is "auto", if a directory is under GOPATH, but also has a go.mod file, "go list" will use GOPATH in 1.12, and use Go module in 1.13. This PR is similar to the behavior of 1.13.
Overall, I think this seems good as long as we can test this throughly. Maybe we can/should also set different CI versions /w different GO111MODULE modes to help facilitate testing... |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
1 similar comment
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Could you please re-pull master. I will get back to this review this week, sorry for the delay. |
@codyoss any progress? |
Sorry, was waiting for the CI to go green, but it appears to have gotten stuck. I will get to this today or tomorrow. |
It looks like there are failures with go generate: https://travis-ci.org/github/golang/mock/jobs/672731180 |
fixed linting issues Add tests unexport error making it Windows compatible merge from upstream
@codyoss fixed CI errors |
It's too bad that in order to get this performance boost we have to not use In the ideal world we would be able to take advantage of some So I suppose we've accepted that we'll sacrifice possibly having to maintain this code path with future Go versions in order to get this speed boost? (Although maybe there won't be much more future maintenance because everything is stable now? Not sure what the Go roadmap looks like here.) |
Yeah, Go's dependency manager is so tightly coupled with Under Bazel's action environment, we don't have access to either GOCACHE or mod cache in the host machine. Every mockgen action runs from cold cache, similar to right after Yes, there is a trade-off between performance and future maintenance. Since Bazel suffers from this issue the more than I thought implementing it in golang/mock would benefit more people. That's why I sent PR here first. |
@codyoss weekly ping... |
@codyoss weekly ping... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this took so long to get back to.
@linzhp Thank you for your contribution! 🎆 |
Description
Partially fixing #419
It turn out there are two places calling
go list
:packages.Load
, which callsgo list
by default.This PR avoids calling
packages.Load
and saves one of thego list
calls. Some performance data:With 0b87a54:
After this PR:
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Reviewer Notes