On May 23, 2020, at 2:34 PM, adithya...@gmail.com wrote:
Is there a way to create a global variable inside go routine stack? so that i can access any time, without passing around between methods/functions. Crazy thought !!!..
--
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/1f790fd5-437f-4a8c-8122-5d6b05841117%40googlegroups.com.
Then came local variables, ones local to a function, which came and went as functions executed, and then block-scoped variables, ones local to a particular begin...end or {...} block of code. This was seen as good, and the people were urged to avoid global variables (and goto and other ways of the past).
--
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/3e71bdf8-3b99-4f47-9412-68cc50f69e84%40googlegroups.com.
if i am not wrong, Even the main itself is a go routine, which have global variables?
On May 26, 2020, at 8:04 PM, Jon Perryman <jon.pe...@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/CAByJhJnn6uLbcM_JBBV%3DJewBQB5iztb23BYHAO98Bvf2nTkPUQ%40mail.gmail.com.
Variables are names associated with values, values that can vary, that is, can be changed. (Unlike constants, which are constant values.)In the beginning, all variables were global, and this was not good.Then came local variables, ones local to a function, which came and went as functions executed, and then block-scoped variables, ones local to a particular begin...end or {...} block of code. This was seen as good, and the people were urged to avoid global variables (and goto and other ways of the past).Now, every combination of ways has a home in some language's culture: static in C is a function-local global variable, Go style embraces global variables for flag values, and there are local variables in sophisticated assembly languages that never go to memory.Now, what problem is it exactly that you want to solve?
On Sun, May 24, 2020 at 11:06 PM <adithya...@gmail.com> wrote:
Yeah this works, but you can say this as workaround, what i really want is, does native go support? if not why?--On Monday, May 25, 2020 at 7:57:17 AM UTC+5:30, tokers wrote:You may try to inspect this go package: https://github.com/jtolio/gls
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 golan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3e71bdf8-3b99-4f47-9412-68cc50f69e84%40googlegroups.com.
You want the gls package referenced earlier.Go doesn’t have it built in because the designers don’t like it or feel it is necessary. You can find and read the GitHub issue that covers thread/go local storage.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
--
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/4ace5c86-1895-4090-90ff-68be45454bdf%40googlegroups.com.
--
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/88474b1b-827e-4dcb-a56e-b942fafe71b8%40googlegroups.com.