[go-nuts] Re: strange stack trace when panic

2017-06-07 Thread winlin
When I run with -gcflags="-l", it works~ winlin$ go run -gcflags="-l" t.go panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x104bf82] goroutine 1 [running]: main.causedPanic() /User

[go-nuts] strange stack trace when panic

2017-06-07 Thread winlin
Hi, I'm confused by the stack trace when panic, and I have searched both in history topics and google. If I use panic, the stack is fine, code is https://play.golang.org/p/Yb7fYW9ro3 , output is: panic: Panic from user goroutine 1 [running]: main.causedPanic()

[go-nuts] Re: letsencrypt, localhost and autocert

2017-06-06 Thread winlin
There is a library base on lego and letsencrypt project: https://github.com/ossrs/go-oryx-lib/blob/master/https/example_test.go#L33 And there is a server as an example for that library: https://github.com/ossrs/go-oryx/blob/develop/httpx-static/main.go#L174 On Wednesday, June 7, 2017 at

[go-nuts] Re: A question about reading of TCP sockets.

2017-05-21 Thread winlin
1516, haha, are you writing a RTMP handshake? The io.Reader is not promise always get the size data, you can use io.CopyN or ReadBuffer. For io.Writer of netFD, it always write all the data. On Saturday, May 20, 2017 at 11:01:44 PM UTC+8, fusi.enr...@gmail.com wrote: > > Hello All > > first I

[go-nuts] Re: Stop HTTP Server with Context cancel

2017-05-16 Thread winlin
Will this be OK? func ListenAndServe(ctx context.Context, srv *http.Server) error { ctx,cancel := context.WitchCancel(ctx) wg := sync.WaitGroup{} defer wg.Wait() wg.Add(1) go func(ctx context.Context) { defer cancel() err := srv.ListenAndServe() fmt.Println("Server err is", err)

[go-nuts] Re: Go 1.8.1 is released

2017-05-16 Thread winlin
Great work! On Saturday, April 8, 2017 at 2:02:49 AM UTC+8, Chris Broadfoot wrote: > > Hi gophers, > > We have just released Go version 1.8.1, a minor point release. > > This release includes fixes to the compiler, runtime, documentation, go > command, and the > crypto/tls, encoding/xml,