Back to all reviewers

Name for purpose first

grafana/grafana
Based on 4 comments
Go

Choose names that lead with their primary purpose or category, followed by specific details. This makes code more discoverable and self-documenting by grouping related items and clearly conveying intent.

Naming Conventions Go

Reviewer Prompt

Choose names that lead with their primary purpose or category, followed by specific details. This makes code more discoverable and self-documenting by grouping related items and clearly conveying intent.

Key guidelines:

  • Start with the general category/area (e.g., ‘sharing’, ‘render’, ‘sanitize’)
  • Follow with specific details or actions
  • Avoid legacy/implementation prefixes unless specifically needed
  • Use directional words when transforming between formats

Example:

// Less clear:
func sanitizeGrpcHeaderValue(value string) string {}
func dashboardImageSharing() {}

// More clear:
func sanitizeHTTPHeaderValueForGRPC(value string) string {}
func sharingDashboardImage() {}

This pattern helps when:

  • Searching for related functionality
  • Understanding transformation direction
  • Grouping related features
  • Maintaining consistent terminology
4
Comments Analyzed
Go
Primary Language
Naming Conventions
Category

Source Discussions