This commit is contained in:
aozhiwei 2023-09-13 10:31:49 +08:00
parent 2ce4c46c71
commit fe65489de2

View File

@ -183,3 +183,13 @@ func GetLocalIP() string {
return ipList[0]
}
}
func NewSlice[T any](s *[]T ,len int32, cap int32){
*s = make([]T, len, cap)
}
func NewSliceElement[T any](s *[]T) *T {
v := new(T)
*s = append(*s, *v)
return v
}