Naming conventions

Hi i need some help with naming some of my packages.
All iā€™m really wondering is it a good idea to have a package that holds names like these and non of the files
have the same name like the package?


EX:
-data (Package name)
-deviceData.go
-settingsData.go
-marshalData.go


And is it a bad idea to have a package whose name is plural.


EX:
-models (Package name)
-settingsModel.go
-deviceModel.go


:slight_smile: :slight_smile: :slight_smile: :slight_smile:

https://blog.golang.org/package-names

Package names are usually singular except the cases when they collide with reserved words like strings, types, etc. In the case of models, I would name it model. However, it is probably more Go idiomatic to call this package types and inside you may have submodules like request, response, etc.

For the filenames that you put here, I would remove all suffixes, they are of no use because it is obvious where they belong to by package name.

1 Like

thanks for the help :heart:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.