Note that goimports theses days adds the package name explicitly to the
import if the package name is not identical to the last component of the
import path. So on the readability front, the cost seem pretty low to me.

It does have a cost on the writing side, as goimports might not find the
package and there's always an extra step to figure out the package name if
you start with the import path (e.g. a GitHub repo).

So yes, I would generally try to avoid it, but it's also not the end of the
world :)

On Thu, Apr 29, 2021, 09:29 Brian Candler <b.cand...@pobox.com> wrote:

> P.S. I don't really recommend this, since you can't tell by inspection of
> main.go which import provides "foo.Greeting".  And I'm struggling to think
> of any real-world examples where I've seen this used.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/f6d72692-3638-406a-84c7-75927ce07a1dn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/f6d72692-3638-406a-84c7-75927ce07a1dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfGHmeoHCo7uMQKR7v%2BCbauLbJ-bwjLDDw_sZ9xGxi4pnQ%40mail.gmail.com.

Reply via email to