1
0

Updated libraries

This commit is contained in:
konrad
2019-05-07 21:42:24 +02:00
parent 2b160b73c3
commit 3d7fd9ca20
313 changed files with 37947 additions and 6783 deletions

32
vendor/golang.org/x/lint/lint.go generated vendored
View File

@ -540,6 +540,18 @@ var knownNameExceptions = map[string]bool{
"kWh": true,
}
func isInTopLevel(f *ast.File, ident *ast.Ident) bool {
path, _ := astutil.PathEnclosingInterval(f, ident.Pos(), ident.End())
for _, f := range path {
switch f.(type) {
case *ast.File, *ast.GenDecl, *ast.ValueSpec, *ast.Ident:
continue
}
return false
}
return true
}
// lintNames examines all names in the file.
// It complains if any use underscores or incorrect known initialisms.
func (f *file) lintNames() {
@ -561,12 +573,22 @@ func (f *file) lintNames() {
// Handle two common styles from other languages that don't belong in Go.
if len(id.Name) >= 5 && allCapsRE.MatchString(id.Name) && strings.Contains(id.Name, "_") {
f.errorf(id, 0.8, link(styleGuideBase+"#mixed-caps"), category("naming"), "don't use ALL_CAPS in Go names; use CamelCase")
return
capCount := 0
for _, c := range id.Name {
if 'A' <= c && c <= 'Z' {
capCount++
}
}
if capCount >= 2 {
f.errorf(id, 0.8, link(styleGuideBase+"#mixed-caps"), category("naming"), "don't use ALL_CAPS in Go names; use CamelCase")
return
}
}
if len(id.Name) > 2 && id.Name[0] == 'k' && id.Name[1] >= 'A' && id.Name[1] <= 'Z' {
should := string(id.Name[1]+'a'-'A') + id.Name[2:]
f.errorf(id, 0.8, link(styleGuideBase+"#mixed-caps"), category("naming"), "don't use leading k in Go names; %s %s should be %s", thing, id.Name, should)
if thing == "const" || (thing == "var" && isInTopLevel(f.f, id)) {
if len(id.Name) > 2 && id.Name[0] == 'k' && id.Name[1] >= 'A' && id.Name[1] <= 'Z' {
should := string(id.Name[1]+'a'-'A') + id.Name[2:]
f.errorf(id, 0.8, link(styleGuideBase+"#mixed-caps"), category("naming"), "don't use leading k in Go names; %s %s should be %s", thing, id.Name, should)
}
}
should := lintName(id.Name)