About source folder organization - Part II

87 views
Skip to first unread message

Victor Giordano

unread,
Mar 21, 2023, 10:28:07 AM3/21/23
to golang-nuts
Hello fellows gophers!

I do wonder how you organize a project within a file system. Due to the hierarchical nature of a fs (where is parent folder that constains child folder) I do wonder how do you organize the source files into folders. Can you show me some examples?

For example, here is a project about a cards game server (Escobita de 15) and also a presentation is provided in order to be usable by a web browser (a front)

You may also peak the code map file that directly describes what it is in each directory.

Well, if any of you can share a project for the sake of understanding how do you organize your sources files I would be greatfull. A code map file would be nice too! (But I know that may be is to much to ask!)

Greettings
Víctor

I tried to talk about this but doesn't get too much insight, so now I'm trying to be more practical (instead of theorical like before).

Eli Lindsey

unread,
Mar 21, 2023, 10:38:22 AM3/21/23
to Victor Giordano, golang-nuts
There are a number of different options and no right or wrong answer. This was a recent blog that I thought did an excellent job of summarizing some of the more common layouts and trade offs https://appliedgo.com/blog/go-project-layout

-eli 

On Mar 21, 2023, at 10:28 AM, Victor Giordano <vituc...@gmail.com> wrote:

Hello fellows gophers!
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/51265059-3821-4f42-b85d-606c3e175fc3n%40googlegroups.com.

Victor Giordano

unread,
Mar 21, 2023, 11:08:29 AM3/21/23
to Eli Lindsey, golang-nuts
Eli, thanks for the insight. Is a very interesting read!.

>There are a number of different options and no right or wrong answer. 
Exactly! I never say that there was a right or wrong answer.
I'm looking to see other real file projects in order to gather more opinions along with something like a "code map"  that highlights why the folder are named like that.

Regarding the reading.

> The same applies to the files-and-directories layout of a project. No single layout fits all purposes.

Well that is true. I mean, I do see a lot of times projects where are folder that are based on problem's domain affairs and some folder based on solution's domain affairs... for example, in the context of an app where you generate reports of things, you may find at the same folder something like:

/reports (domain's level)
/websockets (solution's level)

and there is a mix of criteria used for determining the hierarchies of the fs. This happens a lot, as far as I have seen (and also happens to me!).

Is very interesting... but I do found things.. for example... having at the same level something like "assets" and "webserver", what about the assests a web server uses? Well... have a lot to read.

Thanks again.

--
V
Reply all
Reply to author
Forward
0 new messages