Remove the unused 'upperFirst' function, and fix a potential NPE due to
an incorrect predicate.

Change-Id: I671a3418b82ea77e5c9bb598f2be0b958078e464
Reviewed-on: https://go-review.googlesource.com/c/tools/+/611575
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
This commit is contained in:
Rob Findley 2024-09-06 21:17:09 +00:00 коммит произвёл Gopher Robot
Родитель 075ae7d276
Коммит ce7eed4960
1 изменённых файлов: 1 добавлений и 8 удалений

Просмотреть файл

@ -452,7 +452,7 @@ func loadLenses(settingsPkg *packages.Package, defaults map[settings.CodeLensSou
return nil, fmt.Errorf("%s: declare one CodeLensSource per line", posn)
}
lit, ok := spec.Values[0].(*ast.BasicLit)
if !ok && lit.Kind != token.STRING {
if !ok || lit.Kind != token.STRING {
return nil, fmt.Errorf("%s: CodeLensSource value is not a string literal", posn)
}
value, _ := strconv.Unquote(lit.Value) // ignore error: AST is well-formed
@ -539,13 +539,6 @@ func lowerFirst(x string) string {
return strings.ToLower(x[:1]) + x[1:]
}
func upperFirst(x string) string {
if x == "" {
return x
}
return strings.ToUpper(x[:1]) + x[1:]
}
func fileForPos(pkg *packages.Package, pos token.Pos) (*ast.File, error) {
fset := pkg.Fset
for _, f := range pkg.Syntax {