That would work, but it would break a lot of editor plugins which are just
passing the input using stdin without the filename. I don't think breaking
goimports is worth it (specially, since it's intended as a gofmt
replacement and the latter also works with just stdin, no filename), but
that's not my call to make. Also, it might be desirable to keep
tools/imports (where +90% of the execution time of goimports is spent) able
to work only on memory, with no filesystem available.

In any case, teaching goimports about other identifiers in the same package
feels like a bandaid solution to me. It would be better to just make it
fast at finding Go packages and the other issues would just go away (if you
take finding Go pkgs out of the equation, goimports takes less than a few
milliseconds to do its job).
On Friday, May 15, 2015 at 12:00:48 PM UTC+1, rog wrote:

On 14 May 2015 at 19:44, Alberto García Hierro <[email protected]
<javascript:>> wrote:
That seems like it could cause subtle problems. What happens if I'm editing
foo/bar/baz.go? The tool will read the definitions from package foo (since
it's the working directory where I invoked $EDITOR) while it's actually
feeding it a file from package bar.
godef currently requires that you pass it the file name as well as
providing standard input, from which it can infer the correct package
to parse.
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 11 of 17 | next ›
Discussion Overview
groupgolang-dev @
postedMay 11, '15 at 3:30a
activeMay 18, '15 at 2:40a



site design / logo © 2023 Grokbase