Use singular form for collection repo/folder name #5

Opendmitshur opened this issue 2 years ago
dmitshur commented 2 years ago · edited

Do this:

github.com/golang/example/hello
github.com/golang/example/outyet
golang.org/x/mobile/example/basic
golang.org/x/mobile/example/flappy
golang.org/x/image/...
github.com/shurcooL/tictactoe/player/bad
github.com/shurcooL/tictactoe/player/random

Don't do this:

github.com/golang/examples/hello
github.com/golang/examples/outyet
golang.org/x/mobile/examples/basic
golang.org/x/mobile/examples/flappy
golang.org/x/images/...
github.com/shurcooL/tictactoe/players/bad
github.com/shurcooL/tictactoe/players/random

Notice how "example", "image", "player" folder names simply contain many related packages, yet they use singular form.

Because it's consistent with the style the Go project uses.

Write Preview Markdown
vladimiroff commented 2 years ago

There are packages in the standard library in conflict with this: bytes, errors and strings.

Write Preview Markdown
dmitshur commented 2 years ago · edited

@vladimiroff I don't think those are counter-examples. Neither bytes, errors, nor strings are collections. They're individual packages.

By collection, I mean something like...

https://godoc.org/encoding

It contains encoding/json, encoding/xml, encoding/gob, etc. Notice how it's encoding/json and not encodings/json. It's because the collection folder encoding uses singular form.

Also, this suggestion is primarily for empty folder names that simply contain many packages.

Write Preview Markdown
to comment.