Camellia: A Small Go Linter for Camel-Case Abbreviations
Camellia is a Go linter designed to address the naming convention of camel-case abbreviations in Go code. It promotes a consistent style by suggesting the use of camel case for identifiers that contain abbreviations, making code easier to read. The tool is narrow in scope, focusing on enforcing this naming choice without altering entire projects or style guides.
- ▪Camellia flags Go identifiers with all-caps abbreviation runs and suggests camel-case spelling instead.
- ▪The tool does not attempt to reformat entire projects or create a broad style guide.
- ▪Camellia allows for gradual implementation by supporting an exclude list for specific cases.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 98161) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Kaitian Xie Posted on May 16 Camellia: A Small Go Linter for Camel-Case Abbreviations #go #linting Go code has a long-running naming habit around initialisms: ID, URL, HTTP, API, and friends often stay fully capitalized inside identifiers. That gives you names like UserID, ParseURL, HTTPClient, and APIError. I understand the convention, but I do not like how it reads. My preference is simpler: treat abbreviations like normal words when they are part of a mixed-case identifier.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).