golang-standards / project-layout

Standard Go Project Layout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repository has multiple serious issues

eliben opened this issue · comments

The existence of this repository is harmful for Go beginners. People arrive here from Google searches, looking for ways to structure their small, simple packages. What they find is overwhelming, at the least.

It has several serious issues:

  1. No go.mod file, while modules are becoming a standard for Go dependency management
  2. Suggests to place all exportable code in pkg/, which is outdated advice and no longer recommended for Go projects (as it adds a superfluous path component to every import).
  3. Has a large number of directories, most of which aren't needed by 99% of projects

Please either spend some time to modernize this project, or delete it

Thank you for sharing your thoughts @eliben! I understand where you are coming from and the concerns you are raising. The main README tries to address, at least, some of them. You should leverage as much as it makes sense and for simple projects main.go in the root directory is all you'll need. However, at some point you outgrow that phase...

Note that go modules is still not officially out (even with 1.13). The blog post that goes along with the repo explicitly addresses that. I'll make sure to add a note in the main repo too. As soon as it's fully enabled the repo will be updated to reflect this feature. As a go module user myself i can tell you that it still has rough edges though :-)

The pkg pattern is the most controversial and there's a number of passionate and vocal people, who don't like it. Definitely don't use it if it doesn't make sense for you. Others find it useful though. It's ok to agree to disagree :-) The Go team itself never explicitly recommended it. This is something the core Go code had originally and then various devs in the community started using as a pattern in their Go projects.

@eliben by the way, I saw your recent blog post where you mentioned the official CommonMistakes Go page and how small it is. 50 Shades of Go has a few extras :-)

Coming from the other side: Im a Go beginner (15ys of developing other stuff) and starting to outgrow the "main.go in root" phase. This repository gave me a nice introduction to some concepts and pointers how to structure my projects. So far I havent seen anything comparable from the official Go project team. So, thanks for the good work @kcq !

Coming from the other side: Im a Go beginner (15ys of developing other stuff) and starting to outgrow the "main.go in root" phase. This repository gave me a nice introduction to some concepts and pointers how to structure my projects. So far I havent seen anything comparable from the official Go project team. So, thanks for the good work @kcq !

It's all that matters :) If you find it useful use it (at least, some parts of it) and if not then you can ignore it.

This has been discussed enough and there's enough context for everybody to make their own mind and decide what they want to do. Intimidation, bullying and other toxic comments are not acceptable and will be removed.