Coding style

Please follow these coding standards when writing code for inclusion in Tsuru.

Formatting

Naming standards

New<Something>

is used by the <Something> constructor:

NewApp(name string) (*App, error)

Add<Something>

is a method of a type that has a collection of <Something>’s. Should receive an instance of <Something>:

func (a *App) AddUnit(u *Unit) error

Add

is a collection method that adds one or more elements:

func (a *AppList) Add( apps ...*App) error

Create<Something>

it’s a function that’s save an instance of <Something> in the database. Should receives an instance of <Something>.

func CreateApp(a *App) error

Delete<Something>

it’s a function that’s delete an instance of <Something> from database.

Remove<Something>

it’s opposite of Add<Something>.