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

x/tools/gopls: remove .orig files #35551

Closed
powerman opened this issue Nov 13, 2019 · 12 comments
Closed

x/tools/gopls: remove .orig files #35551

powerman opened this issue Nov 13, 2019 · 12 comments
Labels
Milestone

Comments

@powerman
Copy link

@powerman powerman commented Nov 13, 2019

What version of Go are you using (go version)?

$ go version
go version go1.13.4 linux/amd64

gopls updated about 6 hours ago from latest master

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/powerman/.cache/go-build"
GOENV="/home/powerman/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY="github.com/mtgroupit"
GONOSUMDB="github.com/mtgroupit"
GOOS="linux"
GOPATH="/home/powerman/go"
GOPRIVATE="github.com/mtgroupit"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="x86_64-pc-linux-gnu-gcc"
CXX="x86_64-pc-linux-gnu-g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build024112428=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I've used vim-go to rename some identifier in some main.go using gopls (feature released 6 hours ago).

What did you expect to see?

Identifier renamed without any other side effects.

What did you see instead?

Identifier renamed, but also main.go.orig file was created. Author of this feature in vim-go said there is no option in gopls to avoid creating these backup files: fatih/vim-go#2366 (comment)

Please add such an option, current behaviour is really annoying.

@gopherbot gopherbot added this to the Unreleased milestone Nov 13, 2019
@gopherbot gopherbot added the Tools label Nov 13, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 13, 2019

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@gopherbot gopherbot added the gopls label Nov 13, 2019
@powerman

This comment has been minimized.

Copy link
Author

@powerman powerman commented Nov 13, 2019

$ gopls version
golang.org/x/tools/gopls 0.2.0
    golang.org/x/tools/gopls@v0.2.0 h1:ddCHfScTYOG6auAcEKXCFN5iSeKSAnYcPv+7zVJBd+U=
@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Nov 14, 2019

@ianthehat, is it ok for us to do this, or should we just put the .orig files in some temporary directory?

@ianthehat

This comment has been minimized.

Copy link

@ianthehat ianthehat commented Nov 15, 2019

The internal rename functionality does not generate .orig files, which is why this problem does not surface in VSCode.
However if you use the gopls command line to do the rename, it does.
I think this is probably the wrong choice, we should not be making the .orig files by default, maybe there should be a flag to enable them, but most people do not want them.
I would expect that most people that would care about this kind of thing will either use their VCS or read the diff first, not use the .orig functionality?

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 15, 2019

Change https://golang.org/cl/207347 mentions this issue: internal/lsp/cmd: don't create .orig files for rename by default

@powerman

This comment has been minimized.

Copy link
Author

@powerman powerman commented Nov 21, 2019

After go get -v golang.org/x/tools/gopls@latest I still get .orig files. Are you sure it's fixed?

@powerman

This comment has been minimized.

Copy link
Author

@powerman powerman commented Nov 21, 2019

Any chance new -preserve flag is true by default?

@zikaeroh

This comment has been minimized.

Copy link

@zikaeroh zikaeroh commented Nov 21, 2019

@latest currently means v0.2.1. The fix is in master. If you want this fix, you'd have to wait for a version bump, or install master.

@powerman

This comment has been minimized.

Copy link
Author

@powerman powerman commented Nov 21, 2019

I've also tried @master and even @6d480e2 - no difference.

@zikaeroh

This comment has been minimized.

Copy link

@zikaeroh zikaeroh commented Nov 21, 2019

Are you sure you've gotten both the x/tools module and the x/tools/gopls module at master? Essentially all of the important stuff (including this fix) is in x/tools, not x/tools/gopls. Cloning the whole repo and go install-ing it is the easiest way to get both together without too much pain (though there are other methods; I run at master but use a different way of managing my tool versions).

@powerman

This comment has been minimized.

Copy link
Author

@powerman powerman commented Nov 21, 2019

Thanks! After go get -v golang.org/x/tools@master and then go get -v golang.org/x/tools/gopls@master the fix is working.

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Nov 22, 2019

Glad this is resolved. Thanks, @zikaeroh! Just as a note, running gopls at master is not recommended because there can be breakages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.