Skip to content

Commit

Permalink
additional references
Browse files Browse the repository at this point in the history
  • Loading branch information
kcq committed Aug 26, 2018
1 parent 1022186 commit 3c701b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions pkg/README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down

0 comments on commit 3c701b2

Please sign in to comment.