添加反射
This commit is contained in:
20
main.go
20
main.go
@@ -1,10 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"goLearn/connectPool"
|
|
||||||
"goLearn/model"
|
"goLearn/model"
|
||||||
|
"goLearn/reflect"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var Ch = make(chan model.Task, 3)
|
var Ch = make(chan model.Task, 3)
|
||||||
@@ -34,17 +33,20 @@ func main() {
|
|||||||
|
|
||||||
//---------------------
|
//---------------------
|
||||||
|
|
||||||
donetitle := make(chan struct{})
|
//donetitle := make(chan struct{})
|
||||||
|
//
|
||||||
connectPool.ConnectPool(donetitle)
|
//connectPool.ConnectPool(donetitle)
|
||||||
|
//
|
||||||
time.Sleep(5 * time.Second)
|
//time.Sleep(5 * time.Second)
|
||||||
close(donetitle)
|
//close(donetitle)
|
||||||
defer connectPool.DisconnectPool()
|
//defer connectPool.DisconnectPool()
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
//ctx := context.WithValue(context.Background(), "value", model.Task{Id: "1", Content: "1"})
|
//ctx := context.WithValue(context.Background(), "value", model.Task{Id: "1", Content: "1"})
|
||||||
//goroutine.Runtask(ctx)
|
//goroutine.Runtask(ctx)
|
||||||
|
|
||||||
|
reflect.FuncReflect(make([]int, 3))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
11
reflect/reflect.go
Normal file
11
reflect/reflect.go
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package reflect
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FuncReflect(inter interface{}) {
|
||||||
|
typein := reflect.TypeOf(inter).Elem()
|
||||||
|
fmt.Println("typein:", typein)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user