From 3f4d10fc73b4a7fd87d1e355b3f02c6f6348aff1 Mon Sep 17 00:00:00 2001 From: Peter Weinberger Date: Fri, 24 Jan 2020 09:47:02 -0500 Subject: [PATCH] internal/lsp: small change to helper.go to use ast.IsExported Use ast.IsExported instead of explicit code. Change-Id: I1bfabb3c575debb699a51e38f502fcb99a081203 Reviewed-on: https://go-review.googlesource.com/c/tools/+/216297 Run-TryBot: Peter Weinberger TryBot-Result: Gobot Gobot Reviewed-by: Rebecca Stambler --- internal/lsp/helper/helper.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/lsp/helper/helper.go b/internal/lsp/helper/helper.go index a1cc1dc573f..e90f2f40760 100644 --- a/internal/lsp/helper/helper.go +++ b/internal/lsp/helper/helper.go @@ -128,7 +128,7 @@ func doUses() { continue } nm := fd.Name.String() - if isExported(nm) { + if ast.IsExported(nm) { // we're looking for things like didChange continue } @@ -224,7 +224,7 @@ func whatis(x ast.Expr) string { case *ast.StarExpr: return "*" + whatis(n.X) case *ast.Ident: - if isExported(n.Name) { + if ast.IsExported(n.Name) { // these are from package protocol return "protocol." + n.Name } @@ -238,7 +238,3 @@ func whatis(x ast.Expr) string { return fmt.Sprintf("%T", x) } } - -func isExported(n string) bool { - return n[0] >= 'A' && n[0] <= 'Z' -}