rpc: remove 'exported or builtin' restriction for parameters (#20332)
* rpc: remove 'exported or builtin' restriction for parameters There is no technial reason for this restriction because package reflect can create values of any type. Requiring parameters and return values to be exported causes a lot of noise in package exports. * rpc: fix staticcheck warnings
This commit is contained in:
committed by
Péter Szilágyi
parent
9c6cf960b4
commit
8008c5b1fa
@ -53,24 +53,24 @@ func sequentialIDGenerator() func() ID {
|
||||
|
||||
type testService struct{}
|
||||
|
||||
type Args struct {
|
||||
type echoArgs struct {
|
||||
S string
|
||||
}
|
||||
|
||||
type Result struct {
|
||||
type echoResult struct {
|
||||
String string
|
||||
Int int
|
||||
Args *Args
|
||||
Args *echoArgs
|
||||
}
|
||||
|
||||
func (s *testService) NoArgsRets() {}
|
||||
|
||||
func (s *testService) Echo(str string, i int, args *Args) Result {
|
||||
return Result{str, i, args}
|
||||
func (s *testService) Echo(str string, i int, args *echoArgs) echoResult {
|
||||
return echoResult{str, i, args}
|
||||
}
|
||||
|
||||
func (s *testService) EchoWithCtx(ctx context.Context, str string, i int, args *Args) Result {
|
||||
return Result{str, i, args}
|
||||
func (s *testService) EchoWithCtx(ctx context.Context, str string, i int, args *echoArgs) echoResult {
|
||||
return echoResult{str, i, args}
|
||||
}
|
||||
|
||||
func (s *testService) Sleep(ctx context.Context, duration time.Duration) {
|
||||
@ -81,6 +81,7 @@ func (s *testService) Rets() (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
//lint:ignore ST1008 returns error first on purpose.
|
||||
func (s *testService) InvalidRets1() (error, string) {
|
||||
return nil, ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user