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
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@powerman
Copy link

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 This label describes issues relating to any tools in the x/tools repository. label Nov 13, 2019
@gopherbot
Copy link

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 Issues related to the Go language server, gopls. label Nov 13, 2019
@powerman
Copy link
Author

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

@stamblerre
Copy link
Contributor

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

@ianthehat
Copy link

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
Copy link

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

@powerman
Copy link
Author

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

@powerman
Copy link
Author

Any chance new -preserve flag is true by default?

@zikaeroh
Copy link
Contributor

@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
Copy link
Author

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

@zikaeroh
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

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

@golang golang locked and limited conversation to collaborators Nov 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants