additional references

This commit is contained in:
Kyle Quest 2018-08-26 09:54:58 -07:00
parent 10221863e8
commit 3c701b2e47
2 changed files with 9 additions and 5 deletions

View File

@ -14,7 +14,11 @@ If you need help with naming, formatting and style start by running [`gofmt`](ht
* https://blog.golang.org/package-names
* https://github.com/golang/go/wiki/CodeReviewComments
See [Go Project Layout](https://medium.com/golang-learn/go-project-layout-e5213cdcfaa2) for additional background information.
See [`Go Project Layout`](https://medium.com/golang-learn/go-project-layout-e5213cdcfaa2) for additional background information.
More about naming and organizing packages as well as other code structure recommendations:
* [GopherCon EU 2018: Peter Bourgon - Best Practices for Industrial Programming](https://www.youtube.com/watch?v=PTE4VJIdHPg)
* [GopherCon Russia 2018: Ashley McNamara + Brian Ketelsen - Go best practices.](https://www.youtube.com/watch?v=MzTcsI6tn-0)
## Go Directories
@ -38,9 +42,9 @@ Put your actual application code in the `/internal/app` directory (e.g., `/inter
### `/pkg`
Library code that's safe to use by external applications (e.g., `/pkg/mypubliclib`).
Library code that's ok to use by external applications (e.g., `/pkg/mypubliclib`). Other projects will import these libraries expecting them to work, so think twice before you put something here :-)
Other projects will import these libraries expecting them to work, so think twice before you put something here :-)
It's also a way to group Go code in one place when your root directory contains lots of non-Go components and directories making it easier to run various Go tool (as mentioned in the [`Best Practices for Industrial Programming`](https://www.youtube.com/watch?v=PTE4VJIdHPg) from GopherCon EU 2018).
See the [`/pkg`](pkg/README.md) directory if you want to see which popular Go repos use this project layout pattern. This is a common layout pattern, but it's not universally accepted and some in the Go community don't recommend it.

View File

@ -1,8 +1,8 @@
# `/pkg`
Library code that's safe to use by external applications (e.g., `/pkg/mypubliclib`).
Library code that's ok to use by external applications (e.g., `/pkg/mypubliclib`). Other projects will import these libraries expecting them to work, so think twice before you put something here :-)
Other projects will import these libraries expecting them to work, so think twice before you put something here :-)
It's also a way to group Go code in one place when your root directory contains lots of non-Go components and directories making it easier to run various Go tool (as mentioned in the [`Best Practices for Industrial Programming`](https://www.youtube.com/watch?v=PTE4VJIdHPg) from GopherCon EU 2018).
Note that this is not a universally accepted pattern and for every popular repo that uses it you can find 10 that don't. It's up to you to decide if you want to use this pattern or not. Regardless of whether or not it's a good pattern more people will know what you mean than not. It is a bit confusing for new Go devs, but it's a pretty simple confusion to resolve and that's one of the goals for this project layout repo.