From ee1bbb59a4a9664aed60b4bb8425e36036a57cd4 Mon Sep 17 00:00:00 2001 From: JACKYMYPERSON Date: Sat, 30 Aug 2025 05:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=8D=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 20 +++++++++++--------- reflect/reflect.go | 11 +++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 reflect/reflect.go diff --git a/main.go b/main.go index f8628af..1e470ee 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,9 @@ package main import ( - "goLearn/connectPool" "goLearn/model" + "goLearn/reflect" "sync" - "time" ) var Ch = make(chan model.Task, 3) @@ -34,17 +33,20 @@ func main() { //--------------------- - donetitle := make(chan struct{}) - - connectPool.ConnectPool(donetitle) - - time.Sleep(5 * time.Second) - close(donetitle) - defer connectPool.DisconnectPool() + //donetitle := make(chan struct{}) + // + //connectPool.ConnectPool(donetitle) + // + //time.Sleep(5 * time.Second) + //close(donetitle) + //defer connectPool.DisconnectPool() //------------------ //ctx := context.WithValue(context.Background(), "value", model.Task{Id: "1", Content: "1"}) //goroutine.Runtask(ctx) + + reflect.FuncReflect(make([]int, 3)) + } // diff --git a/reflect/reflect.go b/reflect/reflect.go new file mode 100644 index 0000000..46c6b09 --- /dev/null +++ b/reflect/reflect.go @@ -0,0 +1,11 @@ +package reflect + +import ( + "fmt" + "reflect" +) + +func FuncReflect(inter interface{}) { + typein := reflect.TypeOf(inter).Elem() + fmt.Println("typein:", typein) +}