Go Naming Conventions Available Scripts - — Scans Go code for naming anti-patterns: SCREAMING SNAKE CASE constants, Get-prefixed getters, bad package names (util/helper/common), and receivers named "this"/"self". Run for options. Core Principle Names should: - Not feel repetitive when used - Take context into consideration - Not repeat concepts that are already clear Naming is more art than science—Go names tend to be shorter than in other languages. --- Naming Decision Flow --- MixedCaps (Required) Normative : All Go identifiers must use MixedCaps. Underscores are allowed only in: test funct…

\\t'/\\\\t}\"\n s=\"${s//

Go Naming Conventions Available Scripts - — Scans Go code for naming anti-patterns: SCREAMING SNAKE CASE constants, Get-prefixed getters, bad package names (util/helper/common), and receivers named "this"/"self". Run for options. Core Principle Names should: - Not feel repetitive when used - Take context into consideration - Not repeat concepts that are already clear Naming is more art than science—Go names tend to be shorter than in other languages. --- Naming Decision Flow --- MixedCaps (Required) Normative : All Go identifiers must use MixedCaps. Underscores are allowed only in: test funct…

\\r'/}\"\n s=\"${s//

Go Naming Conventions Available Scripts - — Scans Go code for naming anti-patterns: SCREAMING SNAKE CASE constants, Get-prefixed getters, bad package names (util/helper/common), and receivers named "this"/"self". Run for options. Core Principle Names should: - Not feel repetitive when used - Take context into consideration - Not repeat concepts that are already clear Naming is more art than science—Go names tend to be shorter than in other languages. --- Naming Decision Flow --- MixedCaps (Required) Normative : All Go identifiers must use MixedCaps. Underscores are allowed only in: test funct…

\\n'/\\\\n}\"\n printf '%s' \"$s\"\n}\n\n# Resolve target to a list of .go files (exclude _test.go and vendor)\nfind_go_files() {\n local t=\"$1\"\n if [[ -f \"$t\" ]]; then\n echo \"$t\"\n elif [[ -d \"$t\" ]]; then\n find \"$t\" -name '*.go' ! -name '*_test.go' ! -path '*/vendor/*' ! -path '*/.git/*' 2>/dev/null\n else\n # Handle ./... style patterns\n local dir=\"${t%%/...}\"\n dir=\"${dir:-.}\"\n if [[ -d \"$dir\" ]]; then\n find \"$dir\" -name '*.go' ! -name '*_test.go' ! -path '*/vendor/*' ! -path '*/.git/*' 2>/dev/null\n else\n echo \"error: path not found: $t\" >&2\n exit 2\n fi\n fi\n}\n\nVIOLATIONS=()\n\nadd_violation() {\n local file=\"$1\" line=\"$2\" rule=\"$3\" message=\"$4\"\n VIOLATIONS+=(\"${file}:${line}|${rule}|${message}\")\n}\n\n# Rule 1: SCREAMING_SNAKE_CASE constants\ncheck_screaming_constants() {\n local file=\"$1\"\n local line_num=0\n while IFS= read -r line; do\n line_num=$((line_num + 1))\n # Match const declarations with ALL_CAPS_SNAKE names (2+ uppercase segments with underscore)\n pat='^[[:space:]]*(const[[:space:]]+)[A-Z][A-Z0-9]*_[A-Z0-9_]+[[:space:]]'\n if [[ \"$line\" =~ $pat ]]; then\n local name\n name=$(echo \"$line\" | sed -E -n 's/^[[:space:]]*const[[:space:]]+([A-Z][A-Z0-9]*_[A-Z0-9_]*).*/\\1/p')\n if [[ -n \"$name\" ]]; then\n add_violation \"$file\" \"$line_num\" \"screaming-const\" \"constant '$name' uses SCREAMING_SNAKE_CASE; use MixedCaps instead\"\n fi\n fi\n done \u003c \"$file\"\n}\n\n# Rule 2: Get-prefixed getter methods\ncheck_get_prefix() {\n local file=\"$1\"\n local line_num=0\n while IFS= read -r line; do\n line_num=$((line_num + 1))\n # Match: func (r Type) GetFoo(...) — exported getter with Get prefix\n local re_get='^[[:space:]]*func[[:space:]]+\\([^)]+\\)[[:space:]]+Get([A-Z][a-zA-Z0-9]*)\\('\n if [[ \"$line\" =~ $re_get ]]; then\n local method_name=\"Get${BASH_REMATCH[1]}\"\n # Skip GetX where X could be legitimate (e.g., GetByID is not a simple getter)\n # Only flag simple GetField patterns (no preposition after Get)\n case \"${BASH_REMATCH[1]}\" in\n By*|From*|Or*|With*|All*) continue ;;\n esac\n add_violation \"$file\" \"$line_num\" \"get-prefix\" \"method '$method_name' has Get prefix; Go getters should omit Get (use '${BASH_REMATCH[1]}')\"\n fi\n done \u003c \"$file\"\n}\n\n# Rule 3: Packages named util/helper/common/misc\ncheck_bad_package_names() {\n local file=\"$1\"\n local line_num=0\n while IFS= read -r line; do\n line_num=$((line_num + 1))\n pat='^package[[:space:]]+(util|utils|helper|helpers|common|misc|shared|base|lib)

Go Naming Conventions Available Scripts - — Scans Go code for naming anti-patterns: SCREAMING SNAKE CASE constants, Get-prefixed getters, bad package names (util/helper/common), and receivers named "this"/"self". Run for options. Core Principle Names should: - Not feel repetitive when used - Take context into consideration - Not repeat concepts that are already clear Naming is more art than science—Go names tend to be shorter than in other languages. --- Naming Decision Flow --- MixedCaps (Required) Normative : All Go identifiers must use MixedCaps. Underscores are allowed only in: test funct…

\n if [[ \"$line\" =~ $pat ]]; then\n local pkg_name=\"${BASH_REMATCH[1]}\"\n add_violation \"$file\" \"$line_num\" \"bad-package-name\" \"package '$pkg_name' is too generic; use a specific, descriptive name\"\n fi\n # Only check the first package line\n if [[ \"$line\" =~ ^package[[:space:]] ]]; then\n break\n fi\n done \u003c \"$file\"\n}\n\n# Rule 4: Receivers named \"this\" or \"self\"\ncheck_bad_receivers() {\n local file=\"$1\"\n local line_num=0\n while IFS= read -r line; do\n line_num=$((line_num + 1))\n # Match: func (this *Type) or func (self Type)\n pat='^[[:space:]]*func[[:space:]]+\\([[:space:]]*(this|self)[[:space:]]'\n if [[ \"$line\" =~ $pat ]]; then\n local recv=\"${BASH_REMATCH[1]}\"\n add_violation \"$file\" \"$line_num\" \"bad-receiver\" \"receiver named '$recv'; use a short 1-2 letter abbreviation of the type instead\"\n fi\n done \u003c \"$file\"\n}\n\nFILES=()\nwhile IFS= read -r f; do\n [[ -n \"$f\" ]] && FILES+=(\"$f\")\ndone \u003c \u003c(find_go_files \"$TARGET\")\n\nif [[ ${#FILES[@]} -eq 0 ]]; then\n if $JSON_OUTPUT; then\n echo '{\"violations\":[],\"count\":0,\"status\":\"no_go_files\"}'\n else\n echo \"No Go files found in: $TARGET\"\n fi\n exit 0\nfi\n\nfor file in \"${FILES[@]}\"; do\n check_screaming_constants \"$file\"\n check_get_prefix \"$file\"\n check_bad_package_names \"$file\"\n check_bad_receivers \"$file\"\ndone\n\n# Truncation\nTOTAL=${#VIOLATIONS[@]}\nTRUNCATED=false\nif [[ $LIMIT -gt 0 && $TOTAL -gt $LIMIT ]]; then\n VIOLATIONS=(\"${VIOLATIONS[@]:0:$LIMIT}\")\n TRUNCATED=true\nfi\n\n# Output results\nif $JSON_OUTPUT; then\n echo \"{\"\n echo ' \"violations\": ['\n first=true\n for v in \"${VIOLATIONS[@]+\"${VIOLATIONS[@]}\"}\"; do\n IFS='|' read -r location rule message \u003c\u003c\u003c \"$v\"\n file=\"${location%%:*}\"\n line=\"${location#*:}\"\n $first || echo \",\"\n first=false\n printf ' {\"file\":\"%s\",\"line\":%s,\"rule\":\"%s\",\"message\":\"%s\"}' \\\n \"$(json_escape \"$file\")\" \"$line\" \"$(json_escape \"$rule\")\" \"$(json_escape \"$message\")\"\n done\n echo \"\"\n echo \" ],\"\n printf ' \"total\": %d,\\n' \"$TOTAL\"\n printf ' \"truncated\": %s\\n' \"$TRUNCATED\"\n echo \"}\"\nelse\n if [[ $TOTAL -eq 0 ]]; then\n echo \"No naming violations found.\"\n exit 0\n fi\n\n echo \"Naming violations found:\"\n echo \"\"\n for v in \"${VIOLATIONS[@]}\"; do\n IFS='|' read -r location rule message \u003c\u003c\u003c \"$v\"\n printf \" %s [%s] %s\\n\" \"$location\" \"$rule\" \"$message\"\n done\n if $TRUNCATED; then\n echo \" ... and $((TOTAL - LIMIT)) more (use --limit to adjust)\"\n fi\n echo \"\"\n echo \"Total: $TOTAL violation(s)\"\nfi\n\nif [[ $TOTAL -gt 0 ]]; then\n exit 1\nfi\nexit 0\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":7122,"content_sha256":"5407102eb3c226e0d4118d54e47f50d8797b3ae45fb7ce72a24fe17eb4908dd2"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Go Naming Conventions","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Available Scripts","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"scripts/check-naming.sh","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":" — Scans Go code for naming anti-patterns: SCREAMING_SNAKE_CASE constants, Get-prefixed getters, bad package names (util/helper/common), and receivers named \"this\"/\"self\". Run ","type":"text"},{"text":"bash scripts/check-naming.sh --help","type":"text","marks":[{"type":"code_inline"}]},{"text":" for options.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Core Principle","type":"text"}]},{"type":"paragraph","content":[{"text":"Names should:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Not feel repetitive when used","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Take context into consideration","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Not repeat concepts that are already clear","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Naming is more art than science—Go names tend to be shorter than in other languages.","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Naming Decision Flow","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"What are you naming?\n├─ Package → Short, lowercase, singular noun (no underscores, no mixedCaps)\n├─ Interface → Method name + \"-er\" suffix when single-method (Reader, Writer)\n├─ Receiver → 1-2 letter abbreviation of type (c for Client); consistent across methods\n├─ Constant → MixedCaps; use iota for enums; no ALL_CAPS\n├─ Exported func → Verb or verb-phrase in MixedCaps; no Get prefix for getters\n├─ Variable → Length proportional to scope distance\n│ ├─ Tiny scope (1-7 lines) → single letter (i, n, r)\n│ ├─ Medium scope → short word (count, buf)\n│ └─ Package-level / wide → descriptive (userAccountCount)\n└─ Any name → Check: does it repeat package name or context? If yes, shorten it","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"MixedCaps (Required)","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Normative","type":"text","marks":[{"type":"strong"}]},{"text":": All Go identifiers must use MixedCaps.","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Underscores are allowed only in: test functions (","type":"text"},{"text":"TestFoo_InvalidInput","type":"text","marks":[{"type":"code_inline"}]},{"text":"), generated code, and OS/cgo interop.","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Package Names","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Normative","type":"text","marks":[{"type":"strong"}]},{"text":": Packages must be lowercase with no underscores.","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Short, lowercase, singular nouns. Avoid generic names like ","type":"text"},{"text":"util","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"common","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"helper","type":"text","marks":[{"type":"code_inline"}]},{"text":" — prefer specific names: ","type":"text"},{"text":"stringutil","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"httpauth","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"configloader","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"go"},"content":[{"text":"// Good: user, oauth2, tabwriter\n// Bad: user_service, UserService, count (shadows var)","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/IDENTIFIERS.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/IDENTIFIERS.md","title":null}}]},{"text":" when naming packages, deciding on import aliases, or choosing between generic and specific package names.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Interface Names","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Advisory","type":"text","marks":[{"type":"strong"}]},{"text":": One-method interfaces use \"-er\" suffix.","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Name one-method interfaces by the method plus ","type":"text"},{"text":"-er","type":"text","marks":[{"type":"code_inline"}]},{"text":": ","type":"text"},{"text":"Reader","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"Writer","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"Formatter","type":"text","marks":[{"type":"code_inline"}]},{"text":". Honor canonical method names (","type":"text"},{"text":"Read","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"Write","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"Close","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"String","type":"text","marks":[{"type":"code_inline"}]},{"text":") and their signatures.","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/IDENTIFIERS.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/IDENTIFIERS.md","title":null}}]},{"text":" when defining new interfaces or implementing well-known method signatures.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Receiver Names","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Normative","type":"text","marks":[{"type":"strong"}]},{"text":": Receivers must be short abbreviations, used consistently.","type":"text"}]}]},{"type":"paragraph","content":[{"text":"One or two letters abbreviating the type, consistent across all methods: ","type":"text"},{"text":"func (c *Client) Connect()","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"func (c *Client) Send()","type":"text","marks":[{"type":"code_inline"}]},{"text":". Never use ","type":"text"},{"text":"this","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"self","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/IDENTIFIERS.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/IDENTIFIERS.md","title":null}}]},{"text":" when choosing receiver names or ensuring consistency across methods.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Constant Names","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Normative","type":"text","marks":[{"type":"strong"}]},{"text":": Constants use MixedCaps, never ALL_CAPS or K prefix.","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Name constants by role, not value: ","type":"text"},{"text":"MaxRetries","type":"text","marks":[{"type":"code_inline"}]},{"text":" not ","type":"text"},{"text":"Three","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"DefaultPort","type":"text","marks":[{"type":"code_inline"}]},{"text":" not ","type":"text"},{"text":"Port8080","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"go"},"content":[{"text":"const MaxPacketSize = 512\nconst defaultTimeout = 30 * time.Second","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/IDENTIFIERS.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/IDENTIFIERS.md","title":null}}]},{"text":" when naming constants or choosing between role-based and value-based names.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Initialisms and Acronyms","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Normative","type":"text","marks":[{"type":"strong"}]},{"text":": Initialisms maintain consistent case throughout.","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Initialisms (URL, ID, HTTP, API) must be all uppercase or all lowercase: ","type":"text"},{"text":"HTTPClient","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"userID","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"ParseURL()","type":"text","marks":[{"type":"code_inline"}]},{"text":" — not ","type":"text"},{"text":"HttpClient","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"orderId","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"ParseUrl()","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/IDENTIFIERS.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/IDENTIFIERS.md","title":null}}]},{"text":" when using initialisms in compound names or for the full case table.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Function and Method Names","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Advisory","type":"text","marks":[{"type":"strong"}]},{"text":": No ","type":"text"},{"text":"Get","type":"text","marks":[{"type":"code_inline"}]},{"text":" prefix for simple accessors; use verb-like names for actions.","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Getter for field ","type":"text"},{"text":"owner","type":"text","marks":[{"type":"code_inline"}]},{"text":" is ","type":"text"},{"text":"Owner()","type":"text","marks":[{"type":"code_inline"}]},{"text":", not ","type":"text"},{"text":"GetOwner()","type":"text","marks":[{"type":"code_inline"}]},{"text":". Setter is ","type":"text"},{"text":"SetOwner()","type":"text","marks":[{"type":"code_inline"}]},{"text":". Use ","type":"text"},{"text":"Compute","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"Fetch","type":"text","marks":[{"type":"code_inline"}]},{"text":" for expensive operations.","type":"text"}]},{"type":"paragraph","content":[{"text":"When functions differ only by type, include type at the end: ","type":"text"},{"text":"ParseInt()","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"ParseInt64()","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/IDENTIFIERS.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/IDENTIFIERS.md","title":null}}]},{"text":" when designing getter/setter APIs or naming function variants.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Variable Names","type":"text"}]},{"type":"paragraph","content":[{"text":"Variable naming balances brevity with clarity. Key principles:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scope-based length","type":"text","marks":[{"type":"strong"}]},{"text":": Short names (","type":"text"},{"text":"i","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"v","type":"text","marks":[{"type":"code_inline"}]},{"text":") for small scopes; longer, descriptive names for larger scopes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Single-letter conventions","type":"text","marks":[{"type":"strong"}]},{"text":": Use familiar patterns (","type":"text"},{"text":"i","type":"text","marks":[{"type":"code_inline"}]},{"text":" for index, ","type":"text"},{"text":"r","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"w","type":"text","marks":[{"type":"code_inline"}]},{"text":" for reader/writer)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Avoid type in name","type":"text","marks":[{"type":"strong"}]},{"text":": Use ","type":"text"},{"text":"users","type":"text","marks":[{"type":"code_inline"}]},{"text":" not ","type":"text"},{"text":"userSlice","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"name","type":"text","marks":[{"type":"code_inline"}]},{"text":" not ","type":"text"},{"text":"nameString","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Prefix unexported globals","type":"text","marks":[{"type":"strong"}]},{"text":": Use ","type":"text"},{"text":"_","type":"text","marks":[{"type":"code_inline"}]},{"text":" prefix for package-level unexported vars/consts to prevent shadowing","type":"text"}]}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"go"},"content":[{"text":"for i, v := range items { ... } // small scope\npendingOrders := filterPending(orders) // larger scope\nconst _defaultPort = 8080 // unexported global","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/VARIABLES.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/VARIABLES.md","title":null}}]},{"text":" when naming local variables in functions over 15 lines.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Avoiding Repetition","type":"text"}]},{"type":"paragraph","content":[{"text":"Go names should not feel repetitive when used. Consider the full context:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Package + symbol","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"widget.New()","type":"text","marks":[{"type":"code_inline"}]},{"text":" not ","type":"text"},{"text":"widget.NewWidget()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Receiver + method","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"p.Name()","type":"text","marks":[{"type":"code_inline"}]},{"text":" not ","type":"text"},{"text":"p.ProjectName()","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Context + type","type":"text","marks":[{"type":"strong"}]},{"text":": In package ","type":"text"},{"text":"sqldb","type":"text","marks":[{"type":"code_inline"}]},{"text":", use ","type":"text"},{"text":"Connection","type":"text","marks":[{"type":"code_inline"}]},{"text":" not ","type":"text"},{"text":"DBConnection","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Read ","type":"text"},{"text":"references/REPETITION.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/REPETITION.md","title":null}}]},{"text":" when a package name and its exported symbols feel redundant.","type":"text"}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Avoid Built-In Names","type":"text"}]},{"type":"paragraph","content":[{"text":"Never shadow Go's predeclared identifiers (","type":"text"},{"text":"error","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"string","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"len","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"cap","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"append","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"copy","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"new","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"make","type":"text","marks":[{"type":"code_inline"}]},{"text":", etc.) as variable, parameter, or type names.","type":"text"}]},{"type":"paragraph","content":[{"text":"For detailed guidance","type":"text","marks":[{"type":"strong"}]},{"text":": See ","type":"text"},{"text":"go-declarations","type":"text","marks":[{"type":"code_inline"}]},{"text":" — \"Avoid Using Built-In Names\" section.","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"Quick Reference","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Element","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Rule","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Example","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Package","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"lowercase, no underscores","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"package httputil","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Exported","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"MixedCaps, starts uppercase","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"func ParseURL()","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Unexported","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"mixedCaps, starts lowercase","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"func parseURL()","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Receiver","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"1-2 letter abbreviation","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"func (c *Client)","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Constant","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"MixedCaps, never ALL_CAPS","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"const MaxSize = 100","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Initialism","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"consistent case","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"userID","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"XMLAPI","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Variable","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"length ~ scope size","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"i","type":"text","marks":[{"type":"code_inline"}]},{"text":" (small), ","type":"text"},{"text":"userCount","type":"text","marks":[{"type":"code_inline"}]},{"text":" (large)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Built-in names","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Never shadow predeclared identifiers","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"See ","type":"text"},{"text":"go-declarations","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Validation","type":"text","marks":[{"type":"strong"}]},{"text":": After renaming identifiers, run ","type":"text"},{"text":"bash scripts/check-naming.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" to verify no naming anti-patterns remain. Then run ","type":"text"},{"text":"go build ./...","type":"text","marks":[{"type":"code_inline"}]},{"text":" to confirm the rename didn't break anything.","type":"text"}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Related Skills","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Interface naming","type":"text","marks":[{"type":"strong"}]},{"text":": See ","type":"text"},{"text":"go-interfaces","type":"text","marks":[{"type":"link","attrs":{"href":"../go-interfaces/SKILL.md","title":null}}]},{"text":" when naming interfaces with the ","type":"text"},{"text":"-er","type":"text","marks":[{"type":"code_inline"}]},{"text":" suffix or choosing receiver types","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Package naming","type":"text","marks":[{"type":"strong"}]},{"text":": See ","type":"text"},{"text":"go-packages","type":"text","marks":[{"type":"link","attrs":{"href":"../go-packages/SKILL.md","title":null}}]},{"text":" when naming packages, avoiding ","type":"text"},{"text":"util","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"common","type":"text","marks":[{"type":"code_inline"}]},{"text":", or resolving import collisions","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Error naming","type":"text","marks":[{"type":"strong"}]},{"text":": See ","type":"text"},{"text":"go-error-handling","type":"text","marks":[{"type":"link","attrs":{"href":"../go-error-handling/SKILL.md","title":null}}]},{"text":" when naming sentinel errors (","type":"text"},{"text":"ErrFoo","type":"text","marks":[{"type":"code_inline"}]},{"text":") or custom error types","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Declaration scope","type":"text","marks":[{"type":"strong"}]},{"text":": See ","type":"text"},{"text":"go-declarations","type":"text","marks":[{"type":"link","attrs":{"href":"../go-declarations/SKILL.md","title":null}}]},{"text":" when variable name length depends on scope or when avoiding built-in shadowing","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Style principles","type":"text","marks":[{"type":"strong"}]},{"text":": See ","type":"text"},{"text":"go-style-core","type":"text","marks":[{"type":"link","attrs":{"href":"../go-style-core/SKILL.md","title":null}}]},{"text":" when balancing clarity vs concision in identifier names","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"go-naming","author":"@skillopedia","source":{"stars":102,"repo_name":"golang-skills","origin_url":"https://github.com/cxuu/golang-skills/blob/HEAD/skills/go-naming/SKILL.md","repo_owner":"cxuu","body_sha256":"a6a179636a9654cdb0d62b3a1b45383bd7afc49888728dd1638a8155e353a6a4","cluster_key":"95a70cce395ad8a82202020d9a18eccaa38f69919cba40a7fee550fd7051dfdb","clean_bundle":{"format":"clean-skill-bundle-v1","source":"cxuu/golang-skills/skills/go-naming/SKILL.md","attachments":[{"id":"f5b1bdf9-9de3-5f63-8e94-729dd68291f1","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/f5b1bdf9-9de3-5f63-8e94-729dd68291f1/attachment.md","path":"references/IDENTIFIERS.md","size":4607,"sha256":"713a006a863bc68f5b9b782b2b3174660a11b21795ca1870cc09dacccb02b477","contentType":"text/markdown; charset=utf-8"},{"id":"616974c4-b910-5d06-a459-99aff77aff15","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/616974c4-b910-5d06-a459-99aff77aff15/attachment.md","path":"references/REPETITION.md","size":2030,"sha256":"858aacfef0208b62c7da0f78ff5309aa2dad347772b90f303a761d89a6063b53","contentType":"text/markdown; charset=utf-8"},{"id":"474a9f6a-7b6d-56f0-baa3-75f07a0e9de9","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/474a9f6a-7b6d-56f0-baa3-75f07a0e9de9/attachment.md","path":"references/VARIABLES.md","size":2912,"sha256":"80640f40b9badd238ff3e824b589460d96173652c97a839e26a52e7216f97299","contentType":"text/markdown; charset=utf-8"},{"id":"dc84b8c4-aea4-57cf-8e32-8c2a166e6c20","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/dc84b8c4-aea4-57cf-8e32-8c2a166e6c20/attachment.sh","path":"scripts/check-naming.sh","size":7122,"sha256":"5407102eb3c226e0d4118d54e47f50d8797b3ae45fb7ce72a24fe17eb4908dd2","contentType":"application/x-sh; charset=utf-8"}],"bundle_sha256":"881e5914509cae7e17fceb0ce7d013364d3891f33c425e54016da272872c5cce","attachment_count":4,"text_attachments":4,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/go-naming/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"web-development","category_label":"Web"},"exact_dupes_collapsed_into_this":0},"license":"Apache-2.0","version":"v1","category":"web-development","metadata":{"sources":"Google Style Guide, Uber Style Guide"},"import_tag":"clean-skills-v1","description":"Use when naming any Go identifier — packages, types, functions, methods, variables, constants, or receivers — to ensure idiomatic, clear names. Also use when a user is creating new types, packages, or exported APIs, even if they don't explicitly ask about naming conventions. Does not cover package organization (see go-packages).","allowed-tools":"Bash(bash:*)"}},"renderedAt":1782980856492}

Go Naming Conventions Available Scripts - — Scans Go code for naming anti-patterns: SCREAMING SNAKE CASE constants, Get-prefixed getters, bad package names (util/helper/common), and receivers named "this"/"self". Run for options. Core Principle Names should: - Not feel repetitive when used - Take context into consideration - Not repeat concepts that are already clear Naming is more art than science—Go names tend to be shorter than in other languages. --- Naming Decision Flow --- MixedCaps (Required) Normative : All Go identifiers must use MixedCaps. Underscores are allowed only in: test funct…