I want to log MyStruct value in "defer + go routine" so that logging will
not affect total execution time of the the request.... which works fine as
serving request is not taking 5+seconds...
my question is.. will I get value of "x" in "defer + go routine" as main
module already exit
r.POST("/search", func(c *gin.Context) {
var x MyStruct
x := new(MyStruct)
defer func() {
go func() {
time.Sleep(5000 * time.Millisecond) // for
checking if main request is waiting for this...
log(x)
}()
}()
if c.Bind(&x) == nil {
DoWork()
}
}
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.