From 39bca7d48a0619cae0ff14895c8fc92c4b06608c Mon Sep 17 00:00:00 2001 From: Kyle Quest Date: Fri, 27 Sep 2019 18:34:12 -0700 Subject: [PATCH] more references and additional details about the internal directory --- README.md | 4 ++-- cmd/README.md | 1 + internal/README.md | 13 +++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 60bcda5..3adcd9c 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ See the [`/cmd`](cmd/README.md) directory for examples. ### `/internal` -Private application and library code. This is the code you don't want others importing in their applications or libraries. +Private application and library code. This is the code you don't want others importing in their applications or libraries. Note that this layout pattern is enforced by the Go compiler itself. See the Go 1.4 [`release notes`](https://golang.org/doc/go1.4#internalpackages) for more details. -Put your actual application code in the `/internal/app` directory (e.g., `/internal/app/myapp`) and the code shared by those apps in the `/internal/pkg` directory (e.g., `/internal/pkg/myprivlib`). +You can optionally add a bit of extra structure to your internal packages to separate your shared and non-shared internal code. It's not required (especially for smaller projects), but it's nice to have visual clues showing the intended package use. Your actual application code can go in the `/internal/app` directory (e.g., `/internal/app/myapp`) and the code shared by those apps in the `/internal/pkg` directory (e.g., `/internal/pkg/myprivlib`). ### `/pkg` diff --git a/cmd/README.md b/cmd/README.md index bdb5e68..5589471 100644 --- a/cmd/README.md +++ b/cmd/README.md @@ -15,4 +15,5 @@ Examples: * https://github.com/prometheus/prometheus/tree/master/cmd * https://github.com/influxdata/influxdb/tree/master/cmd * https://github.com/kubernetes/kubernetes/tree/master/cmd +* https://github.com/satellity/satellity/tree/master/cmd/satellity diff --git a/internal/README.md b/internal/README.md index 5442d3e..c85f21c 100644 --- a/internal/README.md +++ b/internal/README.md @@ -1,5 +1,14 @@ # `/internal` -Private application and library code. This is the code you don't want others importing in their applications or libraries. +Private application and library code. This is the code you don't want others importing in their applications or libraries. Note that this layout pattern is enforced by the Go compiler itself. See the Go 1.4 [`release notes`](https://golang.org/doc/go1.4#internalpackages) for more details. -You can optionally add a bit of extra structure to your internal packages to separate your shared and non-shared internal code. It's not required, but it's nice to have visual clues showing the intended package use. Your actual application code can go in the `/internal/app` directory (e.g., `/internal/app/myapp`) and the code shared by those apps in the `/internal/pkg` directory (e.g., `/internal/pkg/myprivlib`). +You can optionally add a bit of extra structure to your internal packages to separate your shared and non-shared internal code. It's not required (especially for smaller projects), but it's nice to have visual clues showing the intended package use. Your actual application code can go in the `/internal/app` directory (e.g., `/internal/app/myapp`) and the code shared by those apps in the `/internal/pkg` directory (e.g., `/internal/pkg/myprivlib`). + +Examples: + +* https://github.com/hashicorp/terraform/tree/master/internal +* https://github.com/influxdata/influxdb/tree/master/internal +* https://github.com/perkeep/perkeep/tree/master/internal +* https://github.com/jaegertracing/jaeger/tree/master/internal +* https://github.com/moby/moby/tree/master/internal +* https://github.com/satellity/satellity/tree/master/internal