From 23133a734476f2590457e87240ab25c2dccb8522 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Wed, 9 Sep 2015 18:03:54 -0400 Subject: [PATCH] Define lock coding convention --- docs/devel/coding-conventions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/devel/coding-conventions.md b/docs/devel/coding-conventions.md index 1569d1aa0d8..8ddf000e205 100644 --- a/docs/devel/coding-conventions.md +++ b/docs/devel/coding-conventions.md @@ -50,6 +50,7 @@ Code conventions - 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. - 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 changes](api_changes.md) - [API conventions](api-conventions.md)