Hacker News new | ask | show | jobs
by enneff 2424 days ago
My advice is to not overthink it and do what works for you.

IMO,

don’t use a pkg directory. It only makes your import paths more unwieldy.

Don’t use internal unless you have a package that is an awkward implementation detail that must be shared between packages for expedience. Usually this can be factored away with some effort but sometimes it’s not worth it.

Do use cmd directories. They make it clear what “go install” will do.

But otherwise really just pick any approach and move on with your life.

1 comments

First of all I think it's cool enneff read my post.

But pkg doesn't only make your import paths unwiedy. I'ts more like that's the only---or at least main---issue with pkg. But you get benefits from it that I talked about: consistent layout structure; know what directories are packages; separate your packages from examples, docs, etc. If pkg only made your import paths unwiedy then no one would use it.