From c1586a3b814668c19b07c3bcef82de4cc8280f51 Mon Sep 17 00:00:00 2001 From: John Guo Date: Sat, 1 Jan 2022 00:58:10 +0800 Subject: [PATCH] improve package gcmd --- os/gcmd/gcmd_command_object.go | 4 ++-- os/gcmd/gcmd_z_unit_feature_object1_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/os/gcmd/gcmd_command_object.go b/os/gcmd/gcmd_command_object.go index 4948741c7..af03f6628 100644 --- a/os/gcmd/gcmd_command_object.go +++ b/os/gcmd/gcmd_command_object.go @@ -70,9 +70,9 @@ func NewFromObject(object interface{}) (rootCmd *Command, err error) { if rootCommandName == "" { rootCommandName = rootCmd.Name } - for i := 0; i < originValueAndKind.InputValue.NumMethod(); i++ { + for i := 0; i < reflectValue.NumMethod(); i++ { var ( - method = originValueAndKind.InputValue.Method(i) + method = reflectValue.Method(i) methodCmd *Command ) methodCmd, err = newCommandFromMethod(object, method) diff --git a/os/gcmd/gcmd_z_unit_feature_object1_test.go b/os/gcmd/gcmd_z_unit_feature_object1_test.go index 901062d74..b799a3126 100644 --- a/os/gcmd/gcmd_z_unit_feature_object1_test.go +++ b/os/gcmd/gcmd_z_unit_feature_object1_test.go @@ -243,7 +243,7 @@ func Test_Command_Pointer(t *testing.T) { t.AssertNil(err) t.Assert(value, `{"Content":"john"}`) }) - + return gtest.C(t, func(t *gtest.T) { var ( ctx = gctx.New()