project-layout
project-layout copied to clipboard
Examples, singular or plural?
The examples folder seems to conflict with: Use singular form for collection repo/folder name. Thoughts?
You are absolutely right! However, even the Go creators deviate from these guidelines. The 'errors', 'strings' and 'bytes' packages are some of those examples.
Either way, it'll be good to add a few references around naming:
- https://github.com/golang/go/wiki/CodeReviewComments
- https://blog.golang.org/package-names
- https://golang.org/doc/effective_go.html#names
Look at comment-2. example(s)
could be a collection of them (as in packer), unlike errors
, strings
, and bytes
. The encoding
example is an excellent reference (encoding/json
, encoding/xml
, encoding/gob
).
I agree people deviate from this one. Just wondering what we would consider as best practice.
If it's not a package name/directory it's ok to deviate from that recommendation/guideline. The examples
directory falls into this category :-) Ultimately it's up to you to decide what makes sense for your project.
in the exceptions to the norm of using singular, provided above, wouldn't "string" (as opposed to "strings") conflict with the reserved keyword string
? same for errors and bytes. I think that may be the rationale behind the exception to use plural