Update golang.org/x/lint commit hash to 738671d (#223)
Update golang.org/x/lint commit hash to 738671d Reviewed-on: https://kolaente.dev/vikunja/api/pulls/223
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
@ -78,7 +78,7 @@ Optionally, add this to your `~/.vimrc` to automatically run `golint` on `:w`
|
||||
|
||||
Add this to your `.emacs` file:
|
||||
|
||||
(add-to-list 'load-path (concat (getenv "GOPATH") "/src/github.com/golang/lint/misc/emacs"))
|
||||
(add-to-list 'load-path (concat (getenv "GOPATH") "/src/golang.org/x/lint/misc/emacs/"))
|
||||
(require 'golint)
|
||||
|
||||
If you have multiple entries in your GOPATH, replace `$GOPATH` with the right value.
|
||||
|
4
vendor/golang.org/x/lint/go.mod
generated
vendored
4
vendor/golang.org/x/lint/go.mod
generated
vendored
@ -1,3 +1,5 @@
|
||||
module golang.org/x/lint
|
||||
|
||||
require golang.org/x/tools v0.0.0-20190311212946-11955173bddd
|
||||
go 1.11
|
||||
|
||||
require golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7
|
||||
|
12
vendor/golang.org/x/lint/go.sum
generated
vendored
12
vendor/golang.org/x/lint/go.sum
generated
vendored
@ -1,6 +1,12 @@
|
||||
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/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
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=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7 h1:EBZoQjiKKPaLbPrbpssUfuHtwM6KV/vb4U85g/cigFY=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
80
vendor/golang.org/x/lint/lint.go
generated
vendored
80
vendor/golang.org/x/lint/lint.go
generated
vendored
@ -198,7 +198,6 @@ func (f *file) lint() {
|
||||
f.lintBlankImports()
|
||||
f.lintExported()
|
||||
f.lintNames()
|
||||
f.lintVarDecls()
|
||||
f.lintElses()
|
||||
f.lintRanges()
|
||||
f.lintErrorf()
|
||||
@ -840,6 +839,7 @@ var commonMethods = map[string]bool{
|
||||
"ServeHTTP": true,
|
||||
"String": true,
|
||||
"Write": true,
|
||||
"Unwrap": true,
|
||||
}
|
||||
|
||||
// lintFuncDoc examines doc comments on functions and methods.
|
||||
@ -977,84 +977,6 @@ var zeroLiteral = map[string]bool{
|
||||
"0i": true,
|
||||
}
|
||||
|
||||
// lintVarDecls examines variable declarations. It complains about declarations with
|
||||
// redundant LHS types that can be inferred from the RHS.
|
||||
func (f *file) lintVarDecls() {
|
||||
var lastGen *ast.GenDecl // last GenDecl entered.
|
||||
|
||||
f.walk(func(node ast.Node) bool {
|
||||
switch v := node.(type) {
|
||||
case *ast.GenDecl:
|
||||
if v.Tok != token.CONST && v.Tok != token.VAR {
|
||||
return false
|
||||
}
|
||||
lastGen = v
|
||||
return true
|
||||
case *ast.ValueSpec:
|
||||
if lastGen.Tok == token.CONST {
|
||||
return false
|
||||
}
|
||||
if len(v.Names) > 1 || v.Type == nil || len(v.Values) == 0 {
|
||||
return false
|
||||
}
|
||||
rhs := v.Values[0]
|
||||
// An underscore var appears in a common idiom for compile-time interface satisfaction,
|
||||
// as in "var _ Interface = (*Concrete)(nil)".
|
||||
if isIdent(v.Names[0], "_") {
|
||||
return false
|
||||
}
|
||||
// If the RHS is a zero value, suggest dropping it.
|
||||
zero := false
|
||||
if lit, ok := rhs.(*ast.BasicLit); ok {
|
||||
zero = zeroLiteral[lit.Value]
|
||||
} else if isIdent(rhs, "nil") {
|
||||
zero = true
|
||||
}
|
||||
if zero {
|
||||
f.errorf(rhs, 0.9, category("zero-value"), "should drop = %s from declaration of var %s; it is the zero value", f.render(rhs), v.Names[0])
|
||||
return false
|
||||
}
|
||||
lhsTyp := f.pkg.typeOf(v.Type)
|
||||
rhsTyp := f.pkg.typeOf(rhs)
|
||||
|
||||
if !validType(lhsTyp) || !validType(rhsTyp) {
|
||||
// Type checking failed (often due to missing imports).
|
||||
return false
|
||||
}
|
||||
|
||||
if !types.Identical(lhsTyp, rhsTyp) {
|
||||
// Assignment to a different type is not redundant.
|
||||
return false
|
||||
}
|
||||
|
||||
// The next three conditions are for suppressing the warning in situations
|
||||
// where we were unable to typecheck.
|
||||
|
||||
// If the LHS type is an interface, don't warn, since it is probably a
|
||||
// concrete type on the RHS. Note that our feeble lexical check here
|
||||
// will only pick up interface{} and other literal interface types;
|
||||
// that covers most of the cases we care to exclude right now.
|
||||
if _, ok := v.Type.(*ast.InterfaceType); ok {
|
||||
return false
|
||||
}
|
||||
// If the RHS is an untyped const, only warn if the LHS type is its default type.
|
||||
if defType, ok := f.isUntypedConst(rhs); ok && !isIdent(v.Type, defType) {
|
||||
return false
|
||||
}
|
||||
|
||||
f.errorf(v.Type, 0.8, category("type-inference"), "should omit type %s from declaration of var %s; it will be inferred from the right-hand side", f.render(v.Type), v.Names[0])
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func validType(T types.Type) bool {
|
||||
return T != nil &&
|
||||
T != types.Typ[types.Invalid] &&
|
||||
!strings.Contains(T.String(), "invalid type") // good but not foolproof
|
||||
}
|
||||
|
||||
// lintElses examines else blocks. It complains about any else block whose if block ends in a return.
|
||||
func (f *file) lintElses() {
|
||||
// We don't want to flag if { } else if { } else { } constructions.
|
||||
|
Reference in New Issue
Block a user