internal/lsp/cache: avoid string(int) conversion
LoadMode and ParseMode are currently hashed with a string(int)
conversion, but this conversion is now discouraged (see the vet check
'stringintconv' for more information). Since the hash uses the code
point, this change replaces these instances with string(rune(int)).
Updates golang/go#32479.
Change-Id: I0d8e91d073fc34ac9faafe75a0d86cf71a5327d4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/232679
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/internal/lsp/cache/check.go b/internal/lsp/cache/check.go
index 4a8d3c2..4cf17e3 100644
--- a/internal/lsp/cache/check.go
+++ b/internal/lsp/cache/check.go
@@ -170,7 +170,7 @@
// Dir, Mode, Env, BuildFlags are the parts of the config that can change.
b.WriteString(config.Dir)
- b.WriteString(string(config.Mode))
+ b.WriteString(string(rune(config.Mode)))
for _, e := range config.Env {
b.WriteString(e)
diff --git a/internal/lsp/cache/parse.go b/internal/lsp/cache/parse.go
index 0bfb7f6..81ef3c7 100644
--- a/internal/lsp/cache/parse.go
+++ b/internal/lsp/cache/parse.go
@@ -111,7 +111,7 @@
func hashParseKey(ph source.ParseGoHandle) string {
b := bytes.NewBuffer(nil)
b.WriteString(ph.File().Identity().String())
- b.WriteString(string(ph.Mode()))
+ b.WriteString(string(rune(ph.Mode())))
return hashContents(b.Bytes())
}