You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 9, 2021. It is now read-only.
Removes the var decl check which often fires when the type is required
for documentation purposes. For example, when an enumerated list of
pre-defined values of a certain type is created, it may be desirable to
group those values under the type itself in the docs. If the type is
infered, godoc will not group them, but if the type is manually listed
they will be placed in the correct location.
Since this lint is not an important stylistic consideration and
frequently produces false positives, removing it is consistent with the
scope of lints in this project.
Fixes#429
Change-Id: I2afd928eae0bb11b39886c045556cda0771e3af5
Reviewed-on: https://go-review.googlesource.com/c/lint/+/191317
Run-TryBot: Sam Whited <sam@samwhited.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
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])
1046
-
returnfalse
1047
-
}
1048
-
returntrue
1049
-
})
1050
-
}
1051
-
1052
-
funcvalidType(T types.Type) bool {
1053
-
returnT!=nil&&
1054
-
T!=types.Typ[types.Invalid] &&
1055
-
!strings.Contains(T.String(), "invalid type") // good but not foolproof
1056
-
}
1057
-
1058
979
// lintElses examines else blocks. It complains about any else block whose if block ends in a return.
1059
980
func (f*file) lintElses() {
1060
981
// We don't want to flag if { } else if { } else { } constructions.
0 commit comments