Updated libraries
This commit is contained in:
2
vendor/golang.org/x/lint/README.md
generated
vendored
2
vendor/golang.org/x/lint/README.md
generated
vendored
@ -9,6 +9,8 @@ Golint requires a
|
||||
|
||||
go get -u golang.org/x/lint/golint
|
||||
|
||||
To find out where `golint` was installed you can run `go list -f {{.Target}} golang.org/x/lint/golint`. For `golint` to be used globally add that directory to the `$PATH` environment setting.
|
||||
|
||||
## Usage
|
||||
|
||||
Invoke `golint` with one or more filenames, directories, or packages named
|
||||
|
3
vendor/golang.org/x/lint/go.mod
generated
vendored
Normal file
3
vendor/golang.org/x/lint/go.mod
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module golang.org/x/lint
|
||||
|
||||
require golang.org/x/tools v0.0.0-20190311212946-11955173bddd
|
6
vendor/golang.org/x/lint/go.sum
generated
vendored
Normal file
6
vendor/golang.org/x/lint/go.sum
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
32
vendor/golang.org/x/lint/lint.go
generated
vendored
32
vendor/golang.org/x/lint/lint.go
generated
vendored
@ -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)
|
||||
|
Reference in New Issue
Block a user