package reflect import ( "testing" "time" ) func TestSet(t *testing.T) { type hack struct { Duration time.Duration Enable bool } h := &hack{} Set(h, "Duration", "1111111111111111") Set(h, "Enable", "T") t.Log(h.Duration) t.Log(h.Enable) }