Merge pull request #13767 from smarterclayton/lock_conventions

Define lock coding convention
pull/6/head
Chao Xu 2015-09-09 15:59:08 -07:00
commit 3dec97e839
1 changed files with 1 additions and 0 deletions

View File

@ -50,6 +50,7 @@ Code conventions
- so pkg/controllers/autoscaler/foo.go should say `package autoscaler` not `package autoscalercontroller`. - so pkg/controllers/autoscaler/foo.go should say `package autoscaler` not `package autoscalercontroller`.
- Unless there's a good reason, the `package foo` line should match the name of the directory in which the .go file exists. - Unless there's a good reason, the `package foo` line should match the name of the directory in which the .go file exists.
- Importers can use a different name if they need to disambiguate. - Importers can use a different name if they need to disambiguate.
- Locks should be called `lock` and should never be embedded (always `lock sync.Mutex`). When multiple locks are present, give each lock a distinct name following Go conventions - `stateLock`, `mapLock` etc.
- API conventions - API conventions
- [API changes](api_changes.md) - [API changes](api_changes.md)
- [API conventions](api-conventions.md) - [API conventions](api-conventions.md)