go-lint is suggesting the following:
method CreateStaticCssPath should be CreateStaticCSSPath
Is the linter correct and if so why?
It allowed the previous method:
CreateStaticJsPath
go-lint is suggesting the following:
method CreateStaticCssPath should be CreateStaticCSSPath
Is the linter correct and if so why?
It allowed the previous method:
CreateStaticJsPath
Copyright © 2021 Jogjafile Inc.
Go naming convention dictates that initialisms should be written in all-caps (actually: in consistent case, depending on whether the first character should be capitalized or not). This is what the linter is complaining about.
Therefore, assuming that CSS and JS are initialisms,
CreateStaticCSSPath
andCreateStaticJSPath
would be the "Go way" to write each of these symbol names.Although the linter's catching of these failures is naturally limited. It's impossible to be 100% accurate here, since context (and human intuition) is necessary.
CreateJs
might mean "create JavaScript" or it might mean "create more than oneJ
" (whatever a "J" is in context).I expect the linter has a hard-coded list of common initialisms (
CSS
,URL
,HTML
,ID
, etc), that are expected to have a very low false positive rate, and looks just for those. Anything else quickly strays into the realm of madness when trying to parse terse symbol names to human-understandable text.