-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
go/analysis/passes/initflagparse: add check for avoid flag.Parse at init #206
base: master
Are you sure you want to change the base?
Conversation
This PR (HEAD: b3bcc7c) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/218757 to see it. Tip: You can toggle comments from me using the |
Message from Agniva De Sarker: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
This PR (HEAD: 2d1136b) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/218757 to see it. Tip: You can toggle comments from me using the |
Message from Bryan C. Mills: Patch Set 4: Run-TryBot+1 Code-Review+1 (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Gobot Gobot: Patch Set 4: TryBots beginning. Status page: https://farmer.golang.org/try?commit=9b4bbe24 Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Gobot Gobot: Patch Set 4: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
This PR (HEAD: 26c541c) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/218757 to see it. Tip: You can toggle comments from me using the |
Message from Agniva De Sarker: Patch Set 5: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Gobot Gobot: Patch Set 5: TryBots beginning. Status page: https://farmer.golang.org/try?commit=98e5ab4b Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Gobot Gobot: Patch Set 5: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Alan Donovan: Patch Set 5: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Ian Cottrell: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
This PR (HEAD: 9863617) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/tools/+/218757 to see it. Tip: You can toggle comments from me using the |
Message from Jesús Espino: Patch Set 6: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Go Bot: Patch Set 4: TryBots beginning. Status page: https://farmer.golang.org/try?commit=9b4bbe24 Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Go Bot: Patch Set 4: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Go Bot: Patch Set 5: TryBots beginning. Status page: https://farmer.golang.org/try?commit=98e5ab4b Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
Message from Go Bot: Patch Set 5: Build is still in progress... Other builds still in progress; subsequent failure notices suppressed until final report. Consult https://build.golang.org/ to see whether they are new failures. Keep in mind that TryBots currently test exactly your git commit, without rebasing. If your commit's git parent is old, the failure might've already been fixed. Please don’t reply on this GitHub thread. Visit golang.org/cl/218757. |
I made the changes to fix the naif approach, but I would like to know how much we want to complicate the things here.
For example, now we have a false positive if you use other package called flag what have a function
Parse
and it is used in theinit
.Other problem can be a function creation during init what contains the
flag.Parse
or functions called from init that calls theflag.Parse
.I guess we want to fix the main straig forward case (what is already solved with this PR) and maybe get rid of the case where the
flag
package is not thebuilt-in
flag package.The other options are more complicated and I'm not sure if provides much value.
I'm also not very sure about the naming of things is correct.
This PR fixes the golang/go#33190 ticket