[go-nuts] gob limitation or bug?

2018-11-19 Thread Hoping White
package main import ( "bytes" "encoding/gob" "fmt" ) var data = bytes.NewBuffer(nil) var buff = bytes.NewBuffer(nil) var encoder = gob.NewEncoder(data) var decoder = gob.NewDecoder(buff) func main() { encode() decode() decode() } func encode() { n := [][]int32{[]int32{1}, [

Re: [go-nuts] How to get explicit receiver of a method through reflect?

2017-11-22 Thread Hoping White
en the > value can be used both to invoke the logic (by calling the one method of > the interface) and for inspecting its concrete type and value. > > > > *Josh Humphries* > jh...@bluegosling.com > > On Wed, Nov 22, 2017 at 8:26 AM, Hoping White > wrote: >

[go-nuts] How to get explicit receiver of a method through reflect?

2017-11-22 Thread Hoping White
Hi, all I known that method of a struct can be a function with explicit receiver, like this type Param struct { v int } func (this *Param) Call() { println(this.v) } p := &Param{v:10} t := p.Call t() I wonder how can I get the receiver p from function t through reflect. Thanks all. --

Re: [go-nuts] Which is a best practice, long run goroutine or short term one?

2017-01-06 Thread Hoping White
outines. > > On Fri, Jan 6, 2017 at 8:11 PM, Hoping White <mailto:baihaop...@gmail.com>> wrote: > Hi, all > > I’m writing a chat server like program, and I must make a decision now. > My business includes two kind of things: > 1. request->response > 2. push mess

[go-nuts] Which is a best practice, long run goroutine or short term one?

2017-01-06 Thread Hoping White
Hi, all I’m writing a chat server like program, and I must make a decision now. My business includes two kind of things: 1. request->response 2. push message One solution is like every connection has 3 goroutines: 1. for read request 2. for write response 3. for execute request But this kind of

Re: [go-nuts] package net/http/pprof causes memory increase

2017-01-06 Thread Hoping White
Sorry, I have tried to provide a simple runnable example to show this problem, but failed It seems that has some connection with the complexity of the program. > 在 2017年1月4日,下午2:52,Dave Cheney 写道: > > Can you provide a runnable sample which shows the problem? > > How are you determining you ar

[go-nuts] package net/http/pprof causes memory increase

2017-01-03 Thread Hoping White
Hi, all I’m trying to use proof package to profile memory usage problem, and I found a strange phenomenon. Every time I profile, the res memory increase about 50m, and it doesn’t decrease anymore. Could this be a bug for proof package? -- You received this message because you are subscribed t

[go-nuts] gob ignores default values, bug or feature?

2016-12-09 Thread Hoping White
Hi, all I find that gob encoding ignores fields when they have zero values. package main import ( "bytes" "encoding/gob" ) type Type struct { Data uint32 } func main() { var t Type buffer := bytes.NewBuffer(nil) encoder := gob.NewEncoder(buffer)

[go-nuts] How to build golang from source on osx sierra?

2016-10-24 Thread Hoping White
Hi, all I have trouble on osx sierra with build golang. As always, I do the following git checkout go1.7.3 cd src && ./all.bash Instead of usual success, I get "fatal error: MSpanList_Insert” I have google this problem, but suggests are rebuild go1.4.3 and bootstrap go1.7.3 But

Re: [go-nuts] encoding/xml Unmarshal problem

2016-07-05 Thread Hoping White
/play.golang.org/p/yCI68Zsg1E> > On Tue, Jul 5, 2016 at 8:04 PM Hoping White <mailto:baihaop...@gmail.com>> wrote: > > Hi, gophers > > > How do I unmarshal an xml as following: > > > data > > > I have tried with > > type Resources struct {

[go-nuts] encoding/xml Unmarshal problem

2016-07-05 Thread Hoping White
Hi, gophers How do I unmarshal an xml as following: data I have tried with type Resources struct { XMLName xml.Name `xml:"resources"` Strings []String `xml:"string"` } type String struct { Name string `xml:"name,attr"` Value string `xml:,chardata"` }

Re: [go-nuts] How to decrypt data with AES in golang

2016-06-30 Thread Hoping White
Hi, Jason Thanks for the reply. I find this project useful and it works for me like charm. https://github.com/celso-wo/rijndael256/blob/master/rijndael256.go > 在 2016年6月30日,下午3:34,Jason Woods 写道: > >> Rijndael -- You recei

[go-nuts] How to decrypt data with AES in golang

2016-06-29 Thread Hoping White
Hi, all I have a C# code to decrypt data as following public static string test(string input, string key) { if (((input == null) || string.IsNullOrEmpty(input.Trim())) || ((input == "false") || (input == "null"))) { return string.Empty;

Re: [go-nuts] How to hide command line argument from ps

2016-06-21 Thread Hoping White
> It's generally a bad idea to try to improve security by hiding args. Much > better to pass the argument another way, for instance via an open file > descriptor that the program reads the value from. > > > On Tue, Jun 21, 2016, 07:16 Hoping White <mailto:baihaop...@gmail.

[go-nuts] How to hide command line argument from ps

2016-06-21 Thread Hoping White
Hi, all I wonder is there a way to hide command line arguments from programs like “ps”? I can rewrite argv parameter for main in c language, or use LD_PRELOAD to intercept libc_start_main, but all these methods do not be functional in go. Thanks. -- You received this message because you a