[go-nuts] Is there some way to set value for unexported nil ptr field of a struct using reflect?

2017-07-23 Thread feilengcui008
ldA? here is the full code fuzz.go <https://gist.github.com/feilengcui008/1ef29539bf7ccab5993c796ca2ddf227#file-fuzz-go-L44> Hope to get some advice, thanks in advance! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubs

Re: [go-nuts] Is there some way to set value for unexported nil ptr field of a struct using reflect?

2017-07-26 Thread feilengcui008
lem() newv := reflect.New(v.Type().Elem()) v.Set(newv) 在 2017年7月26日星期三 UTC+8上午9:08:50,Ian Lance Taylor写道: > > On Sun, Jul 23, 2017 at 12:46 AM, feilengcui008 > wrote: > > Hi, all: > > I'm writing a little fuzz tool for struct using reflect package, and > > came

Re: [go-nuts] Is there some way to set value for unexported nil ptr field of a struct using reflect?

2017-07-27 Thread feilengcui008
; On Wed, Jul 26, 2017 at 6:53 PM feilengcui008 > wrote: > >> Thanks for your answer :), even though the original question has been >> deleted. >> >> I've used the reflect.NewAt to allocate a new memory at the same address >> of the unexported field's refl

[go-nuts] Re: gopacket, libpcap timestamp precison

2017-07-27 Thread feilengcui008
Not sure whether understand your need, but if your need is the reassembly of TCP packets, you can use the tcpassembly packet in gopacket, I recently used it in my traffic replay project tcplayer <https://github.com/feilengcui008/tcplayer>, it seems working just fine. 在 2017年7月28日星期五 UT

[go-nuts] Question about type information for map and slice

2017-04-29 Thread feilengcui008
Hey, All I'm curious about what happened when map or slice is assigned to interface variables. I know the interface implementation in go runtime is: type iface struct{ tab *itab data unsafe.Pointer } and the interface static and dynamic type infomation are stored in itab, when we use r

[go-nuts] Re: Question about type information for map and slice

2017-04-29 Thread feilengcui008
thods of readerImpl also happened in compiling phase? if so, this is kind of similar with C++ virtual functions? 在 2017年4月30日星期日 UTC+8上午3:23:54,T L写道: > > > > On Saturday, April 29, 2017 at 9:56:20 PM UTC+8, feilengcui008 wrote: >> >> Hey, All >> >> I'm

[go-nuts] Re: Question about type information for map and slice

2017-04-30 Thread feilengcui008
Thanks a lot! 在 2017年4月30日星期日 UTC+8下午1:45:26,T L写道: > > > > On Sunday, April 30, 2017 at 10:54:07 AM UTC+8, feilengcui008 wrote: >> >> So, if i do this: >> //assign some var to interface type >> var i io.Reader = readerImpl >> i.Read(buf) >&

[go-nuts] interface assignment

2017-05-01 Thread feilengcui008
Hey, All: I have made a little testing about interface assignment and searched the source code about interface runtime functions like convI2I, and notice that there are two situations where data may be copied or not: (1) data not copied: assign another* interface type* variable to t

Re: [go-nuts] interface assignment

2017-05-01 Thread feilengcui008
Thanks for the clear explanation! 在 2017年5月1日星期一 UTC+8下午9:55:30,Ian Lance Taylor写道: > > On Mon, May 1, 2017 at 6:03 AM, feilengcui008 > wrote: > > > > I have made a little testing about interface assignment and searched > the > > source code about interface

[go-nuts] Re: would it be good a go runtime support both GC (garbage collection) and ARC (automatic reference counting)?

2017-05-12 Thread feilengcui008
If there are ARCs like shared_ptr in C++, I think there must be some kind of raw pointers not managed by gc, this means bringing more "unsafe". 在 2017年5月5日星期五 UTC+8上午12:00:18,T L写道: > > sometimes, I really want to some memory blocks be collected when they > become unreferenced immediately.. >