Skip to content

goimports -srcdir will soon also accept a full filename #956

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
bradfitz opened this issue Jul 21, 2016 · 2 comments
Closed

goimports -srcdir will soon also accept a full filename #956

bradfitz opened this issue Jul 21, 2016 · 2 comments

Comments

@bradfitz
Copy link

As discussed in dominikh/go-mode.el#146 for emacs,

As of https://golang.org/cl/25140, goimports -srcdir=.... will accept a full filename of the file being edited, instead of just its directory. (But directory will still work as it does today)

You'll probably want to update vim-go to pass the full name, which will enable some new features in goimports. (analyzing other files in your package's directory for better recommendations, and being aware of global variables)

@fatih
Copy link
Owner

fatih commented Jul 22, 2016

Thanks @bradfitz for the feedback 👍 Agree that it's a terrible name as well :) Btw, we also write to a temp file first (to catch errors and not lose undo history) and then rename the tempfile to the actual one.

With the patch #957, the final command will be something like:

goimports -w -srcdir '/Users/fatih/Code/go/src/demo/demo.go' /var/folders/g2/wr9dxcns1y50g5lz0lg1__pc0000gn/T/nvimDmFecf/2

Let me know if you need anything else. I'll merge it once the CL is being accepted.

@bradfitz
Copy link
Author

I submitted https://golang.org/cl/25140 so feel free to make the change whenever.

Thanks!

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

No branches or pull requests

2 participants