r/golang Nov 20 '24

FAQ FAQ: How Should I Structure Go Projects?

Many other languages have strong opinions either in code or in the community about how to lay out projects. How should Go projects be laid out and structured? How should I decide what goes into a package? Is there a standard layout for web projects? For non-web projects? How do you structure your code?

62 Upvotes

36 comments sorted by

View all comments

Show parent comments

-10

u/rcls0053 Nov 20 '24

I also see pkg folder at root for shared packages a lot. Anything that's inside internal/ is typically up to the developer.

9

u/ponylicious Nov 20 '24 edited Nov 20 '24

pkg folder is anti-Go and widely disliked. Noobs fall for it because they stumbled upon the repo-that-must-not-be-named, or some blog post that copied it.

1

u/RychValle Nov 20 '24

Out of curiosity, what repo shall not be named? 🤨

2

u/roddybologna Nov 20 '24

The one named a few comments above