Skip to content

Commit ae5f11c

Browse files
committed
remove unused single data type
1 parent bd973b6 commit ae5f11c

2 files changed

Lines changed: 1 addition & 16 deletions

File tree

pkg/wshrpc/wshrpcmeta.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,12 @@ type WshRpcMethodDecl struct {
1515
Command string
1616
CommandType string
1717
MethodName string
18-
CommandDataType reflect.Type
1918
CommandDataTypes []reflect.Type
2019
DefaultResponseDataType reflect.Type
2120
}
2221

2322
func (decl *WshRpcMethodDecl) GetCommandDataTypes() []reflect.Type {
24-
if len(decl.CommandDataTypes) > 0 {
25-
return decl.CommandDataTypes
26-
}
27-
if decl.CommandDataType != nil {
28-
return []reflect.Type{decl.CommandDataType}
29-
}
30-
return nil
23+
return decl.CommandDataTypes
3124
}
3225

3326
var contextRType = reflect.TypeOf((*context.Context)(nil)).Elem()
@@ -86,15 +79,10 @@ func generateWshCommandDecl(method reflect.Method) *WshRpcMethodDecl {
8679
decl.Command = strings.ToLower(cmdStr)
8780
decl.CommandType = getWshCommandType(method)
8881
decl.MethodName = method.Name
89-
var cdataType reflect.Type
9082
var cdataTypes []reflect.Type
91-
if method.Type.NumIn() > 1 {
92-
cdataType = method.Type.In(1)
93-
}
9483
for idx := 1; idx < method.Type.NumIn(); idx++ {
9584
cdataTypes = append(cdataTypes, method.Type.In(idx))
9685
}
97-
decl.CommandDataType = cdataType
9886
decl.CommandDataTypes = cdataTypes
9987
decl.DefaultResponseDataType = getWshMethodResponseType(decl.CommandType, method)
10088
return decl

pkg/wshrpc/wshrpcmeta_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ func TestGenerateWshCommandDecl_MultiArgs(t *testing.T) {
3131
if decl.CommandDataTypes[0].Kind() != reflect.String || decl.CommandDataTypes[1].Kind() != reflect.Int {
3232
t.Fatalf("unexpected command data types: %#v", decl.CommandDataTypes)
3333
}
34-
if decl.CommandDataType == nil || decl.CommandDataType.Kind() != reflect.String {
35-
t.Fatalf("expected legacy single data type to remain first arg type, got %v", decl.CommandDataType)
36-
}
3734
if len(decl.GetCommandDataTypes()) != 2 {
3835
t.Fatalf("expected helper to return two command data types")
3936
}

0 commit comments

Comments
 (0)