Skip to content

Commit ce7eed4

Browse files
findleyrgopherbot
authored andcommitted
doc/generate: minor cleanup
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Robert Findley <[email protected]>
1 parent 075ae7d commit ce7eed4

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

gopls/doc/generate/generate.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func loadLenses(settingsPkg *packages.Package, defaults map[settings.CodeLensSou
452452
return nil, fmt.Errorf("%s: declare one CodeLensSource per line", posn)
453453
}
454454
lit, ok := spec.Values[0].(*ast.BasicLit)
455-
if !ok && lit.Kind != token.STRING {
455+
if !ok || lit.Kind != token.STRING {
456456
return nil, fmt.Errorf("%s: CodeLensSource value is not a string literal", posn)
457457
}
458458
value, _ := strconv.Unquote(lit.Value) // ignore error: AST is well-formed
@@ -539,13 +539,6 @@ func lowerFirst(x string) string {
539539
return strings.ToLower(x[:1]) + x[1:]
540540
}
541541

542-
func upperFirst(x string) string {
543-
if x == "" {
544-
return x
545-
}
546-
return strings.ToUpper(x[:1]) + x[1:]
547-
}
548-
549542
func fileForPos(pkg *packages.Package, pos token.Pos) (*ast.File, error) {
550543
fset := pkg.Fset
551544
for _, f := range pkg.Syntax {

0 commit comments

Comments
 (0)