... | ... | @@ -77,6 +77,10 @@ Stork's backend is implemented in Golang, and we strive to follow the [Effective |
|
|
|
|
|
Stork build system provides the `rake fmt:backend` command to format the Golang code automatically. You SHOULD run this command to ensure the code adheres to the formatting style. In addition, you SHOULD run the `rake lint:backend` command checking that the code passes the linter checks. The code having any formatting or linter issues cannot be merged.
|
|
|
|
|
|
## Imports Order
|
|
|
|
|
|
We first include the packages from the standard library, then 3rd party packages, and at the end, our project packages.
|
|
|
|
|
|
## File Names
|
|
|
|
|
|
The `.go` file names should reflect their contents. For example, if a file mainly contains the code modelling a subnet and defining some operations on the subnet, the `subnet.go` is a suitable name. The relevant unit tests should be in the `subnet_test.go`. If multiple words are needed to describe the contents (e.g., modelling a shared network), the appropriate file name SHOULD contain multiple words without any separator (e.g., `sharednetwork.go`). The relevant unit tests should be in `sharednetwork_test.go`.
|
... | ... | @@ -187,10 +191,6 @@ Examples from PrimeNG: |
|
|
|
|
|
Use all all-lowercase characters for file names. Use dash as a separator (e.g. stork-agent.go). This is consistent with the current practice in kea. Not mixing lower/upper cases will also help avoid name conflicts in a case insensitive file system, such as MacOS.
|
|
|
|
|
|
## Ordering Imports in Go
|
|
|
|
|
|
We include first packages from standard library, then 3rd party packages and at the end our own project packages.
|
|
|
|
|
|
## Line length
|
|
|
|
|
|
The project kicked off in 2019. FullHD is ubiquitous with large 4K displays are getting common. In the general case, the code should have no more than 128 columns. This is let developers display two panels side by side. In some exceptional cases (such as URL), the code may be extended to 160 columns, but this should be rare occurrence.
|
... | ... | |