From 19fec6dcbba6fadcee2fd646d345ad5a911f96ec Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 14 Apr 2020 12:06:47 -0700 Subject: [PATCH] Revert 8c66644ac63ba89d9d3b92f4a67dd2bd23e0440a...a5bb682aa4b69b4fe3cf1107c49bbe44feef1a60 on CodeReviewComments --- CodeReviewComments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CodeReviewComments.md b/CodeReviewComments.md index 4cd6a591..680b6116 100644 --- a/CodeReviewComments.md +++ b/CodeReviewComments.md @@ -598,6 +598,6 @@ In any case, the onus is on you to fail with a helpful message to whoever's debu ## Variable Names -Variable names should be descriptive and they should facilitate the reading. Local variables with limited scope should be short rather than long. Prefer short common names when the meaning is obvious for the other developers, such as loop indices. For example prefer `i` to `sliceIndex` in loops, and prefer `t` to `testing` in tests. However, more unusual things and global variables need more descriptive names. +Variable names in Go should be short rather than long. This is especially true for local variables with limited scope. Prefer `c` to `lineCount`. Prefer `i` to `sliceIndex`. -The basic rules: The further from its declaration that a name is used, the more descriptive the name must be. If you have to write a comment explaining the variable, consider using a more descriptive name. \ No newline at end of file +The basic rule: the further from its declaration that a name is used, the more descriptive the name must be. For a method receiver, one or two letters is sufficient. Common variables such as loop indices and readers can be a single letter (`i`, `r`). More unusual things and global variables need more descriptive names. \ No newline at end of file