feat(Go-StudyExample):增加cast类型转换工具包测试

This commit is contained in:
Huangzj
2020-12-28 09:56:34 +08:00
parent 15ff62152d
commit cdc446fe8a
6 changed files with 134 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
/*
* @Author : huangzj
* @Time : 2020/12/28 9:52
* @Description
*/
package cast
import (
"fmt"
"github.com/spf13/cast"
"testing"
)
func TestCastPoint(t *testing.T) {
p := new(int)
*p = 8
fmt.Println(cast.ToInt(p)) // 8
pp := &p
fmt.Println(cast.ToInt(pp)) // 8
}