Skip to content

Commit

Permalink
doc/generate: minor cleanup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
findleyr authored and gopherbot committed Sep 6, 2024
1 parent 075ae7d commit ce7eed4
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions gopls/doc/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ce7eed4

Please sign in to comment.