go: Fix things staticcheck complains about
Client: go
Staticcheck is the recommended replacement of the frozen and deprecated
official golint linter [1].
Fix the things it complained about (or add lint:ignore directive) in:
- lib/go/thrift
- lib/go/test/tests
- tutorial/go/src
- test/go/src
- compiler generated code
The majority of the fixes are in the following categories:
- Use of deprecated function (mainly the TConfiguration related ones)
- Redundant break in switch cases
- Unused and unexported variables/fields/functions
Also in the same spirit as fb539ae, remove the error return from
NewTSSLSocket as it can never be non-nil.
This change will be cherry-picked into 0.15.0 branch after merged.
[1]: https://groups.google.com/g/golang-nuts/c/rCP70Aq_tBc
diff --git a/lib/go/test/tests/thrifttest_driver.go b/lib/go/test/tests/thrifttest_driver.go
index b351295..29ccd53 100644
--- a/lib/go/test/tests/thrifttest_driver.go
+++ b/lib/go/test/tests/thrifttest_driver.go
@@ -66,7 +66,9 @@
"Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, " +
"Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa " +
"Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, مازِرونی, Bahasa " +
+ //lint:ignore ST1018 intentionally use unicode characters here
"Melayu, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, " +
+ //lint:ignore ST1018 intentionally use unicode characters here
"Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, " +
"Occitan, Иронау, Papiamentu, Deitsch, Polski, پنجابی, پښتو, " +
"Norfuk / Pitkern, Português, Runa Simi, Rumantsch, Romani, Română, " +
@@ -222,7 +224,7 @@
}
err := client.TestException(defaultCtx, "Xception")
- if e, ok := err.(*thrifttest.Xception); ok == false || e == nil {
+ if e, ok := err.(*thrifttest.Xception); !ok || e == nil {
t.Fatal("TestException Xception failed:", err)
} else if e.ErrorCode != 1001 || e.Message != "Xception" {
t.Fatal("TestException Xception failed:", e)