> could i do this in golang?
No. Go does not have any form of goroutine-local or thread-local
storage, nor identifiers.
Dave.
goroutines don't have any kind of local storage or id.
If you want to pass the same state of a number of functions then you
should make them methods on a struct that stores that state.
eg.
type Context struct {
logger log.Logger
}
func A(w http.ResponseWriter, req *http.Request) {
a:= new(Context)
a.logger = log.New()
a.B()
a.C()
}
func (c *Context)B() {
c.logger.Info("im in func B!")
// ...
}
func (c *Context) C() {
// ...
}
--
=====================
http://jessta.id.au
package global
type Context struct {
logger log.Logger
}
func A(w http.ResponseWriter, req *http.Request) {
ABC.B()
XYZ.C()
}
func B() {
QWE.D()// ...
}
func C() {
// ...
}