func main() {
Ā go Func()
}
func Func() {
Ā SetLogTrackId("xxxx")
Ā LogDebug("123")
Ā call1()
}
func call1() {
Ā Ā LogDebug("call1")
}
var trackId string //need this scope to be goroutine scope
func SetLogTrackId(id string) {
Ā Ā trackId = id
}
func LogDebug(v ...interface{}) {
Ā Ā log.Println("DEBUG " + trackId + " " + fmt.Sprintln(v...))
}
is there a goroutine scope global veriable ?Ā Ā soĀ I can do this ?
On Wed, Jun 19, 2019 at 10:41 AM hui zhang <fastf...@gmail.com> wrote:
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/53512dd1-8c24-460d-9bf5-646ea1e95d0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1187971360.3926.1560962237733%40wamui-berry.atl.sa.earthlink.net.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CALoEmQy_p7hs%3DxrWGFx65r7xb63wGi_dg6aL6PRFfG7%2BwFP7-Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAKOF695n5b0xQENWZK-hS1MUZ7ezGVBM9wRj6Vhr1eJDam%3DaEQ%40mail.gmail.com.