Re: [go-nuts] Golang application local timezone doesn't change with the system timezone

2022-02-10 Thread E Z
timezone. It's not a perfect solution, but I think it's enough for my scenario. On Wednesday, February 9, 2022 at 5:16:28 PM UTC-8 Ian Lance Taylor wrote: > On Wed, Feb 9, 2022 at 3:37 PM E Z wrote: > > > > I noticed a phenomenon while maintaining my golang application,

[go-nuts] Golang application local timezone doesn't change with the system timezone

2022-02-09 Thread E Z
I noticed a phenomenon while maintaining my golang application, the local timezone of the application always keep the value when it starts, the local timezone will not change even though I change the system timezone. It looks like the golang time package has been caching the current timezone. I

Re: [go-nuts] Any good idea to stop the goroutine as soon as possible?

2022-01-12 Thread E Z
ctx.Err() really simplifies the whole process. I'll use it to optimize my task executor, thanks. On Wednesday, 12 January 2022 at 10:05:57 UTC Brian Candler wrote: > >> On Wednesday, 12 January 2022 at 08:41:23 UTC lege...@gmail.com wrote: >> >>> What I think it's not so good is that I must add t

Re: [go-nuts] Any good idea to stop the goroutine as soon as possible?

2022-01-12 Thread E Z
t 10:31 PM Axel Wagner wrote: > > > On Wed, Jan 12, 2022 at 3:01 AM E Z wrote: > >> Thank you very much. >> >> I understand that we can use context.Context to resolve the network >> blocking problem in long-running function if the network library support >>

Re: [go-nuts] Any good idea to stop the goroutine as soon as possible?

2022-01-11 Thread E Z
Thank you very much. I understand that we can use context.Context to resolve the network blocking problem in long-running function if the network library support passing a context parameter. But for the CPU-bound code, Is the following implementation mentioned by axel the only way to make a

[go-nuts] Any good idea to stop the goroutine as soon as possible?

2022-01-11 Thread E Z
I'm using golang to implement a task schedule and process system. I found that golang can't stop the goroutine externally, we must wait for the goroutine to end itself. I can stop a goroutine through a channel, however, the only time to check the value of the channel is when the select is call

Re: [go-nuts] The behavior of the function variable which points to the struct method

2021-08-11 Thread E Z
Thank you so much. Your explanation makes my understanding of this problem more and more clear. However, since I have been a C programmer for a long time, I still don't understand the implementation of the function variable in Golang very well. I think I need to do some inspection about functi

Re: [go-nuts] The behavior of the function variable which points to the struct method

2021-08-10 Thread E Z
design. I don't think we want to get different results later on just because of a simple assignment(`pf := gz.Display`). On Tuesday, August 10, 2021 at 3:05:03 PM UTC-7 bse...@computer.org wrote: > On Tue, Aug 10, 2021 at 3:50 PM E Z wrote: > >> It works when I changed the code as you

Re: [go-nuts] The behavior of the function variable which points to the struct method

2021-08-10 Thread E Z
rmation on this topic on Google. Is there any extended reading on this topic? On Tuesday, August 10, 2021 at 12:07:26 PM UTC-7 bse...@computer.org wrote: > On Tue, Aug 10, 2021 at 12:01 PM E Z wrote: > >> I feel confused when I use the function pointer which point to the struct >&

[go-nuts] The behavior of the function variable which points to the struct method

2021-08-10 Thread E Z
I feel confused when I use the function pointer which point to the struct method. Here is the test code: /*** package main type Zoo struct { Animal string } func (z Zoo) Display(){ fmt.Printf("Current animal is:%s\n", z.Animal) } func main(){ gz := &Zoo{ Animal: "Monkey",