Golang's Ridiculous Common Initialisms
Contents
This post is also available in following languages
Golang is well known for its opinionated in coding style. It provides a lint tool thoughtfully, which is good, but failed to provide any mechanism to override or config it, except not using it at all.
As one coming from Java world, knowing Go’s in favor of camel case is pleasant. Not that much when realizing it treats common acronym words as all caps in variable or function names, such as userID
instead of userId
.
You may think this is no big deal? Ok, what if you want to use some naming like this in your code: makeHttpUrlConnection
, getHttpApiUrl
and isHttpsApiHost
. Writing these might lead go lint to give you following suggestions: makeHTTPURLConnection
, getHTTPAPIURL
and isHTTPSAPIHost
. Totally ridiculous and hard-reading namings.
Want to mute the crazy complaints? Sorry, go lint does not support customization. It’s hard-coded here: https://github.com/golang/lint/blob/master/lint.go#L742. Apparently they don’t think it’s a problem at all, see discussion:
Author Gan Dong
LastMod 2016-05-16