Open
Description
A package name like this one would be accepted by the code
- foo_bar_test
The current code is like this
// Package names need slightly different handling than other names.
if strings.Contains(walker.fileAst.Name.Name, "_") && !strings.HasSuffix(walker.fileAst.Name.Name, "_test") {
walker.onFailure(lint.Failure{
Failure: "don't use an underscore in package name",
Confidence: 1,
Node: walker.fileAst.Name,
Category: lint.FailureCategoryNaming,
})
}
So anything that contains more than a _ and and with _test is accepted.
I think about using (pseudo-code)
- strings.CutSufix(packageName, "_test")
- then check if it was present
- then strings.Contains(packageNameWithoutTestSuffix, "_")
Originally posted by @ccoVeille in #1312 (comment)