Skip to content

tools/gopls: add command line support for suggestedfix #174

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

Closed
wants to merge 6 commits into from

Conversation

kalmanb
Copy link
Contributor

@kalmanb kalmanb commented Oct 21, 2019

This adds support for calling suggestedfix from the gopls command line, e.g.

$ gopls suggestedfix ~/tmp/foo/main.go

Optional arguments are:
-w, which writes the changes back to the original file; and
-d, which prints a unified diff to stdout
With no arguments, the changed files are printed to stdout.

Wasn't sure if the command should be suggestedfix or just fix or quickfix?
Also this applies all changes to a file, does not allow for selective fixes.

Updates golang/go#32875

This commit adds support for calling suggestedfix from the gopls command line, e.g.

$ gopls suggestedfix ~/tmp/foo/main.go

Optional arguments are:
- -w, which writes the changes back to the original file; and
- -d, which prints a unified diff to stdout
With no arguments, the changed files are printed to stdout.
@gopherbot
Copy link
Contributor

This PR (HEAD: a0a0341) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/tools/+/202480 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
Within the next week or so, a maintainer will review your change and provide
feedback. See https://golang.org/doc/contribute.html#review for more info and
tips to get your patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11, it means that this CL will be reviewed as part of the next development
cycle. See https://golang.org/s/release for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@knight6782
Copy link

knight6782 commented Oct 21, 2019 via email

@gopherbot
Copy link
Contributor

Message from Ian Cottrell:

Patch Set 1:

Nice!
I think the command should just be called fix, and in theory it should just apply "preferred" fixes by default, with flags that allow more fine grained control (along with maybe -all to just apply all fixes)


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: d344403) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/tools/+/202480 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Kalman Bekesi:

Patch Set 2:

Patch Set 1:

Nice!
I think the command should just be called fix, and in theory it should just apply "preferred" fixes by default, with flags that allow more fine grained control (along with maybe -all to just apply all fixes)

Yeah, good idea. I've made the updates, although it does feel light on tests.


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Kalman Bekesi:

Patch Set 3: Commit message was updated.


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Rebecca Stambler:

Patch Set 4: Run-TryBot+1 Code-Review+2

Thanks - this looks great! Agreed that we need some more tests, but unfortunately we don't have many suggested fixes (except for those in the opt-in tool staticcheck). You could enable staticcheck by adding "staticcheck": true as in https://golang.org/cl/202620 and add tests using the suggested fixes in staticcheck, if you'd like to. This can be done in a follow-up CL too.

Thank you for your contributions!


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 4:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=d0db29b5


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 4:

Build is still in progress...
This change failed on freebsd-amd64-12_0:
See https://storage.googleapis.com/go-build-log/a754d299/freebsd-amd64-12_0_a323a16f.log

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/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Rebecca Stambler:

Patch Set 5: Patch Set 4 was rebased


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Rebecca Stambler:

Patch Set 5: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=2f84b39f


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 4: TryBot-Result-1

8 of 10 TryBots failed:
Failed on freebsd-amd64-12_0: https://storage.googleapis.com/go-build-log/a754d299/freebsd-amd64-12_0_a323a16f.log
Failed on linux-386: https://storage.googleapis.com/go-build-log/a754d299/linux-386_74c4cc05.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/a754d299/linux-amd64_213e1da0.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/a754d299/windows-amd64-2016_574d973d.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/a754d299/linux-amd64-race_ad4267c1.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/a754d299/windows-386-2008_fa5dc78d.log
Failed on openbsd-amd64-64: https://storage.googleapis.com/go-build-log/a754d299/openbsd-amd64-64_c9160bd3.log
Failed on android-amd64-emu: https://storage.googleapis.com/go-build-log/a754d299/android-amd64-emu_cd6e952a.log

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/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5:

Build is still in progress...
This change failed on freebsd-amd64-12_0:
See https://storage.googleapis.com/go-build-log/a754d299/freebsd-amd64-12_0_2119ee0e.log

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/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 5: TryBot-Result-1

8 of 10 TryBots failed:
Failed on freebsd-amd64-12_0: https://storage.googleapis.com/go-build-log/a754d299/freebsd-amd64-12_0_2119ee0e.log
Failed on linux-amd64: https://storage.googleapis.com/go-build-log/a754d299/linux-amd64_0056abe3.log
Failed on linux-386: https://storage.googleapis.com/go-build-log/a754d299/linux-386_2f4cd35f.log
Failed on windows-amd64-2016: https://storage.googleapis.com/go-build-log/a754d299/windows-amd64-2016_76d334bb.log
Failed on linux-amd64-race: https://storage.googleapis.com/go-build-log/a754d299/linux-amd64-race_282c63cb.log
Failed on windows-386-2008: https://storage.googleapis.com/go-build-log/a754d299/windows-386-2008_0d4212af.log
Failed on openbsd-amd64-64: https://storage.googleapis.com/go-build-log/a754d299/openbsd-amd64-64_383edf11.log
Failed on android-amd64-emu: https://storage.googleapis.com/go-build-log/a754d299/android-amd64-emu_20f9b197.log

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/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Rebecca Stambler:

Patch Set 5: -Run-TryBot

TryBot failures are unrelated - caused by golang/go#35226.


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 070fcda) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/tools/+/202480 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Rebecca Stambler:

Patch Set 7: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 7:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=84f7b430


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 7: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/202480.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Oct 30, 2019
This adds support for calling suggestedfix from the gopls command line, e.g.

$ gopls suggestedfix ~/tmp/foo/main.go

Optional arguments are:
-w, which writes the changes back to the original file; and
-d, which prints a unified diff to stdout
With no arguments, the changed files are printed to stdout.

Wasn't sure if the command should be `suggestedfix` or just `fix` or `quickfix`?
Also this applies all changes to a file, does not allow for selective fixes.

Updates golang/go#32875

Change-Id: I8b75f9824be82974f6edb7c03383b4d56116943c
GitHub-Last-Rev: 070fcda
GitHub-Pull-Request: #174
Reviewed-on: https://go-review.googlesource.com/c/tools/+/202480
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@gopherbot
Copy link
Contributor

This PR is being closed because golang.org/cl/202480 has been merged.

@gopherbot gopherbot closed this Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants