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/test/go/src/common/simple_handler.go b/test/go/src/common/simple_handler.go
index 971f17e..fb95457 100644
--- a/test/go/src/common/simple_handler.go
+++ b/test/go/src/common/simple_handler.go
@@ -23,6 +23,7 @@
"errors"
"time"
+ //lint:ignore ST1001 allow dot import here
. "github.com/apache/thrift/test/go/src/gen/thrifttest"
)
@@ -104,6 +105,7 @@
}
func (p *simpleHandler) TestInsanity(argument *Insanity) (r map[UserId]map[Numberz]*Insanity, err error) {
+ //lint:ignore ST1005 To be consistent with other language libraries.
return nil, errors.New("No Insanity")
}
@@ -125,6 +127,7 @@
e.Message = arg
return e
case "TException":
+ //lint:ignore ST1005 To be consistent with other language libraries.
return errors.New("Just TException")
}
return