In this article, we going to analyze the naming convention for the essential parts of our code.
- Project Naming
--- Package Naming
------ Files Naming
Project Naming Convention in Golang
Name your project using lower case, that is very helpful if you are working in a library. Using lowercase your imports, repository or go.mo will looks better.
Package Naming Convention in Golang
Try to keep the package name as short as possible, is better to use lowercase, never use camelCase, and even is not recommended to use snake_case.
For example, use:
Filename Convention in Golang
Like the packages, the file names should be as short as possible but use descriptive and meaningful according to the code defined inside or the purpose of the file.
If the file name contains more than one word, you should use snake_case.go instead of camelCase.go.
Post a Comment