Re: [go-nuts] Curious about this snippet in /src/runtime/proc.go

2017-06-20 Thread Tyler Compton
Sent in a CL for some documentation on this. https://github.com/golang/go/issues/20717 https://go-review.googlesource.com/#/c/46212/ On Mon, Jun 19, 2017 at 10:56 AM wrote: > It won't blank as much as it can get it's hands on. The default value for > the pointer will be nil so it will try and

[go-nuts] Re: Go's scheduler always “stuck” after certain time when executing the code below

2017-06-20 Thread Ronald
If* proposition P1 is always true on golang, *then we could deduce that golang is not good at cpu intensive applications, of course we could unload the jobs to Cgo, but that would be no consistency at all. On Wednesday, 21 June 2017 13:12:12 UTC+8, Ronald wrote: > > I found this: https://github

[go-nuts] Re: Go's scheduler always “stuck” after certain time when executing the code below

2017-06-20 Thread Ronald
Hi Dave, thanks for your reply :) Could you please have one more look on this ? Looking forward to hear the answer from you, thanks a lot. On Wednesday, 21 June 2017 12:55:23 UTC+8, Dave Cheney wrote: > > Yes, this is expect

[go-nuts] Re: Go's scheduler always “stuck” after certain time when executing the code below

2017-06-20 Thread Ronald
I found this: https://github.com/golang/go/issues/7190. Then I replace : go func() { for { } }() With: go func() { ct := 0 t1 := time.Now().UnixNano() for { ct++ if ct%6 == 0 { t2 := time.Now().UnixNano()

[go-nuts] Re: Go's scheduler always “stuck” after certain time when executing the code below

2017-06-20 Thread Dave Cheney
Yes, this is expected. Don't write infinite loops like that. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more op

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Kiki Sugiaman
It leaves something to be desired, yes. I guess you could propose the inverse of the marshaling step to the unmarshaling criteria. Something like "if the xml tag is the string value of basic go types, unmarshal into those types". I don't know if this would break go1compat, but feel free to for

[go-nuts] [ANN] New package for interning strings

2017-06-20 Thread Scott Pakin
I just released a package called intern for speeding up string comparisons. Install it in the usual manner: go get github.com/spakin/intern The package defines two interned-string types, Eq and LGE, and functions to allocate them. Internally, both are repre

[go-nuts] Re: Go's scheduler always “stuck” after certain time when executing the code below

2017-06-20 Thread Ronald
PS: go func() { for { } }() The reason of this code above is that I want to test the channel's latency when some 'indecency' goroutine is seizing several whole OS threads. On Wednesday, 21 June 2017 11:40:12 UTC+8, Ronald wrote: > > Hi, I found when running this code below (play >

[go-nuts] Go's scheduler always “stuck” after certain time when executing the code below

2017-06-20 Thread Ronald
Hi, I found when running this code below (play ): package main import "fmt" import "runtime" import "time" type callRet struct { ret int } type callIn struct { ret_chan chan *callRet arg1 int } func caller(call_in_c chan *callIn, arg1 int) int { ret_c :=

[go-nuts] Re: RFC: Blog post: How to not use an HTTP router

2017-06-20 Thread Marwan abdel moneim
I am not sure, but i think you may find this interesting https://github.com/mrwnmonm/handler On Monday, June 19, 2017 at 12:02:37 AM UTC+2, Axel Wagner wrote: > > Hey gophers, > > in an attempt to rein in the HTTP router epidemic, I tried writing down a) > why I think *any* router/muxer might n

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Dat Huynh
Hi, I think something is wrong here. If it is not a bug of the library, I think we will need to re-think why we need to build the library. Why do we need to marshal something and then we cannot unmarshal it? Thank you very much. Regards, Dat. On Wed, Jun 21, 2017 at 11:57 AM, Kiki Sugiam

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Kiki Sugiaman
According to the docs, the library marshals according to the following criteria: The name for the XML elements is taken from, in order of preference: - - the name of the marshaled type As a result, the library translates a sequence of slice elements of go basic types into a sequence of xml el

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Dat Huynh
I created an issue for this on github. https://github.com/golang/go/issues/20735 Regards, Dat. On Wed, Jun 21, 2017 at 9:30 AM, Ian Lance Taylor wrote: > On Mon, Jun 19, 2017 at 3:40 PM, Dat Huynh wrote: > > > > I am using the libraries "encoding/xml" and "encoding/json" to marshal > and

Re: [go-nuts] Marshal and unmarshal data using in encoding/xml and encoding/json packages

2017-06-20 Thread Ian Lance Taylor
On Mon, Jun 19, 2017 at 3:40 PM, Dat Huynh wrote: > > I am using the libraries "encoding/xml" and "encoding/json" to marshal and > unmarshal a slice. > > I wonder why the method Unmarshal in encoding/xml does not return a slice as > what I have from encoding/json. > > The below is my example. > ht

Re: [go-nuts] Create methods for structs at runtime

2017-06-20 Thread Ian Lance Taylor
On Jun 20, 2017 2:03 PM, "Dat Huynh" wrote: Hi Ian, The struct instance I create for an interface will actually take the role of transport layer. I will not implement the real logic of the methods of the interface in client side. The real implementation for the logic of the methods will be imple

Re: [go-nuts] Create methods for structs at runtime

2017-06-20 Thread Josh Humphries
This is a problem that is usually solved in Go with code generation. You would use a go:generate directive to generate implementations for an interface of interest. Something like java.lang.reflect.Proxy in Go would be very cool though. *Josh Humphries* jh...@bluegosling.com On Tue, Jun 20,

Re: [go-nuts] Create methods for structs at runtime

2017-06-20 Thread Dat Huynh
Hi Ian, The struct instance I create for an interface will actually take the role of transport layer. I will not implement the real logic of the methods of the interface in client side. The real implementation for the logic of the methods will be implemented on the server side only. In the implem

Re: [go-nuts] Create methods for structs at runtime

2017-06-20 Thread Henrik Johansson
I think perhaps http://www.grpc.io/ can help if you want remoting but perhaps it will also give you too much bootstrap. tis 20 juni 2017 kl 22:00 skrev Ian Lance Taylor : > On Mon, Jun 19, 2017 at 8:38 PM, Dat Huynh wrote: > > > > On Tuesday, June 20, 2017 at 4:07:46 AM UTC+10, Ian Lance Taylor

Re: [go-nuts] Create methods for structs at runtime

2017-06-20 Thread Ian Lance Taylor
On Mon, Jun 19, 2017 at 8:38 PM, Dat Huynh wrote: > > On Tuesday, June 20, 2017 at 4:07:46 AM UTC+10, Ian Lance Taylor wrote: >> >> On Sat, Jun 17, 2017 at 5:17 PM, Dat Huynh wrote: >> > Why do you need this feature? > > > I have already answered the question in my email replying Lutz Horn. Than

Re: [go-nuts] Re: %T, type assertions and the Go spec

2017-06-20 Thread Ian Lance Taylor
On Tue, Jun 20, 2017 at 12:46 PM, Will Hawkins wrote: > > On Jun 20, 2017 3:40 PM, "Ian Lance Taylor" wrote: > > On Mon, Jun 19, 2017 at 11:30 PM, Will Hawkins > wrote: >> >> On Tuesday, June 20, 2017 at 2:19:25 AM UTC-4, Volker Dobler wrote: >>> >>> On Tuesday, 20 June 2017 06:52:58 UTC+2, Will

Re: [go-nuts] Re: %T, type assertions and the Go spec

2017-06-20 Thread Will Hawkins
On Jun 20, 2017 3:40 PM, "Ian Lance Taylor" wrote: On Mon, Jun 19, 2017 at 11:30 PM, Will Hawkins wrote: > > On Tuesday, June 20, 2017 at 2:19:25 AM UTC-4, Volker Dobler wrote: >> >> On Tuesday, 20 June 2017 06:52:58 UTC+2, Will Hawkins wrote: >>> >>> I know that there is a difference between in

Re: [go-nuts] Re: %T, type assertions and the Go spec

2017-06-20 Thread Ian Lance Taylor
On Mon, Jun 19, 2017 at 11:30 PM, Will Hawkins wrote: > > On Tuesday, June 20, 2017 at 2:19:25 AM UTC-4, Volker Dobler wrote: >> >> On Tuesday, 20 June 2017 06:52:58 UTC+2, Will Hawkins wrote: >>> >>> I know that there is a difference between interface values and dynamic >>> types and dynamic valu

[go-nuts] Re: %T, type assertions and the Go spec

2017-06-20 Thread Volker Dobler
There might be a difference between the wording used in the formal language specification and the documentation of packages? Personally I cannot see why someone might interpret "type" in the documentation of fmt.Printf as being the static type of interface{}. V. On Tuesday, 20 June 2017 08:30:2

[go-nuts] Re: why this goroutine always faster than main goroutine?

2017-06-20 Thread James Bardin
It's only polite to let other's know when cross-posting questions, to avoid wasting time. https://stackoverflow.com/questions/44657084/why-main-goroutine-always-be-the-second-to-be-invoked The answer and comments there seems to cover most aspects of the behavior you're seeing. On Tuesday, Ju

[go-nuts] Re: golang RFB proxy with VNC auth

2017-06-20 Thread amit . bet
func (auth *ServerAuthVNC) Auth(c common.Conn) error { buf := make([]byte, 8+len([]byte(AUTH_FAIL))) rand.Read(buf[:16]) // Random 16 bytes in buf sndsz, err := c.Write(buf[:16]) if err != nil { log.Printf("Error sending challenge to client: %s\n", err.Error()) return err

[go-nuts] why this goroutine always faster than main goroutine?

2017-06-20 Thread Jun An
here is the code, why can't main goroutine be a little quick and exit then discard another goroutine? package main import ( "sync" "time" ) func main() { var wg sync.WaitGroup wg.Add(1) go func() { wg.Wait() println("wait exit") }() go func() { time.Sleep(time.Second) wg.Done() }() wg.Wait(

[go-nuts] Opening for Golang Consultant @ Plano, TX

2017-06-20 Thread bala313
Greetings, This is *Balaji* from *IDC Technologies;* we have an Urgent job opening for below position. If you’re interested please revert back with updated resume and rate expectation on hourly basis. Thanks J *Job Title:* Golang Consultant *Location:* Plano, TX *Duration:* Long Term

[go-nuts] fun: Gödel Escher Bach typogenetics game implemented in Go

2017-06-20 Thread Dan Kortschak
This is the bare bones implementation to allow playing with the game. Unstated assumptions from the book are not guessed at and the system is fairly broadly configurable. https://github.com/kortschak/typo -- You received this message because you are subscribed to the Google Groups "golang-nuts"