FAQ

On Fri, May 15, 2015 at 2:15 PM, Alberto García Hierro wrote:

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.
It can be an optional optimization. If the filename is available, goimports
is able to find unexported symbols in the current package, and thus reduce
the number of times it scans the GOPATH.

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.
The proposed code would neither increase nor reduce the number of times the
filesystem is touched; you can scan the current packages only when there is
at least one unknown symbol in the source code, but before indexing the
whole GOPATH.

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).
I agree that it's just a part of a more global solution, but I wouldn't
call it bandaid. When you have a bottleneck in your software, both making
the code faster and reducing the number of times it is invoked are valid
optimizations.
--
Giovanni Bajo

--
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 golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

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

People

Translate

site design / logo © 2021 Grokbase