Re: [go-nuts] Re: Error Handling Question

2022-10-24 Thread Robert Engels
Dan, If it walks like a duck… You make a great case why Go should have checked exceptions. If anything the Go error handling model tries to be checked exceptions - every error should be explicitly handled - without any of the conveniences of exceptions - common blocks, stack traces and call

Re: [go-nuts] Error Handling Question

2022-10-21 Thread Robert Engels
Unchecked exceptions in Java denote programming errors or critical unrecoverable errors. If these are being trapped/handled it is indicative of a system with design errors. (That being said, some programming errors can be ignored/handled at the request level - indicating that the chance any

Re: [go-nuts] Non-mutable / readonly slices?

2022-10-20 Thread Robert Engels
I think it you review github.com/robaho/leveldb you’ll see that returning a copy works fine and has very little performance impact. If the caller then modifies it - that’s on them. Still, you could return an object like Value that is immutable with accessor methods. You almost always need a

Re: [go-nuts] behavior of %f

2022-10-10 Thread robert engels
He was using that as an example to show that the value contained in the float is not 1, but less than 1, even though the print shows it as 1. > On Oct 10, 2022, at 8:07 PM, Bakul Shah wrote: > > On Oct 10, 2022, at 5:40 PM, Dante Castagnoli > wrote: >> >> Also, if you were to take an

Re: [go-nuts] behavior of %f

2022-10-10 Thread robert engels
I will add that this is why most financial applications using “fixed place” or “integer math” libraries - to have control over these sorts of issues. An example is robaho/fixed > On Oct 10, 2022, at 6:35 PM, Dante Castagnoli > wrote: > > Thanks, Rob, > > As

Re: [go-nuts] Go routine context

2022-10-02 Thread Robert Engels
Dan Kortschak' via golang-nuts > wrote: > > On Sun, 2022-10-02 at 06:15 -0500, Robert Engels wrote: >> Again, I would like a link to the source of statement to evaluate it >> in context. > > https://manningbooks.medium.com/interview-with-brian-goetz-7d6c47

Re: [go-nuts] Go routine context

2022-10-02 Thread Robert Engels
Also, until fairly recently Go routines were non preemptive- making them even closer to a coroutine. I have no idea when this statement was made to judge that aspect as well. > On Oct 2, 2022, at 6:15 AM, Robert Engels wrote: > >  > By many definitions Go routines and vir

Re: [go-nuts] Go routine context

2022-10-02 Thread Robert Engels
a fairly misunderstanding of the subject. > >> On Saturday, October 1, 2022 at 11:13:19 PM UTC+2 al...@pbrane.org wrote: >> Robert Engels once said: >> > I think you’ll find the article interesting. It is certainly written >> > by a CS “god” that knows what he’s ta

Re: [go-nuts] Go routine context

2022-10-01 Thread Robert Engels
I don’t see any arguments refuting the claim? Can you include a link so the analysis can be read in context? > On Oct 1, 2022, at 4:13 PM, Anthony Martin wrote: > > Robert Engels once said: >> I think you’ll find the article interesting. It is certainly written >> by

Re: [go-nuts] Go routine context

2022-10-01 Thread robert engels
I admit that I probably read into that based on the historical use of ThreadLocals to carry context in traditional ‘request is a thread’ systems. I think as Axel pointed out it is more explicit in the ’structured concurrency’ paper. In Java the Thread has always carried context - it is used in

Re: [go-nuts] Go routine context

2022-10-01 Thread Robert Engels
about "Structured Concurrency" and "Extent local >> variables" - the latter sounds as if it *could* be what you talk about, but >> that article doesn't seem to exist yet. >> >>> On Sat, Oct 1, 2022 at 6:15 AM Robert Engels wrote: >>> Again, please

Re: [go-nuts] Go routine context

2022-09-30 Thread Robert Engels
invoked by the routine. > On Sep 30, 2022, at 11:12 PM, Robert Engels wrote: > > I disagree. I think if you read the article you’ll understand why. You need > to invert the context handling - the pattern you cite is exactly the pattern > the author describes but when you crea

Re: [go-nuts] Go routine context

2022-09-30 Thread Robert Engels
, sure, go for it, but it's far too > restrictive to demand it a priori and force it on others. > > -rob > > > >> On Sat, Oct 1, 2022 at 1:39 PM Ian Lance Taylor wrote: >> On Fri, Sep 30, 2022 at 7:32 AM Robert Engels wrote: >> > >> > Very interest

Re: [go-nuts] Go routine context

2022-09-30 Thread Robert Engels
the ugliness of coloring every function in the path with a context variable. I think you’ll find the article interesting. It is certainly written by a CS “god” that knows what he’s talking about. > On Sep 30, 2022, at 10:39 PM, Ian Lance Taylor wrote: > > On Fri, Sep 30, 2022 at 7:32

Re: [go-nuts] Go routine context

2022-09-30 Thread Robert Engels
Java has an InheritableThreadLocal for that very reason - that is automatically propagated and the child can subsequently override if needed. > On Sep 30, 2022, at 9:43 AM, Ian Davis wrote: > >  >> On Fri, 30 Sep 2022, at 3:32 PM, Robert Engels wrote: >> Very interes

[go-nuts] Go routine context

2022-09-30 Thread Robert Engels
Very interesting article came out recently. https://www.infoq.com/articles/java-virtual-threads/ and it has implications for the Go context discussion and the author makes a very good case as to why using the thread local to hold the context - rather than coloring every method in the chain is

Re: [go-nuts] Sets

2022-09-27 Thread robert engels
collections package is more important than range support. > On Sep 27, 2022, at 5:53 PM, Ian Davis wrote: > > On Tue, 27 Sep 2022, at 6:57 PM, Robert Engels wrote: >> The github set issue is impossible to follow without using github. >> >> Please simply define the inte

[go-nuts] Sets

2022-09-27 Thread Robert Engels
The github set issue is impossible to follow without using github. Please simply define the interfaces. The implementations will follow. You can have simple iterators, indexed iterators, map (key/value) iterators, errorable iterators, closable iterators. You can define how to provide/adapt

Re: [go-nuts] understanding interface conversions

2022-09-22 Thread Robert Engels
As a follow up, good OO is not easy. It’s not for everyone. If you have a utility need it’s probably overkill - but so many of the discussions in this list revolve around people not understanding OO and what it provides. > On Sep 22, 2022, at 8:01 PM, Robert Engels wrote: > > 

Re: [go-nuts] understanding interface conversions

2022-09-22 Thread Robert Engels
t;> On Thu, Sep 22, 2022 at 6:30 PM Robert Engels wrote: >> I would like to understand the reason to type assert but not cast? That is >> an OO design flaw. > > You can only type-assert an interface. With type-assertion, you are either > checking if the underlyin

Re: [go-nuts] understanding interface conversions

2022-09-22 Thread Robert Engels
I would like to understand the reason to type assert but not cast? That is an OO design flaw. > On Sep 22, 2022, at 7:24 PM, burak serdar wrote: > >  > > >> On Thu, Sep 22, 2022 at 6:08 PM Robert Engels wrote: >> 100% true. The difficulty when examining a “large

Re: [go-nuts] understanding interface conversions

2022-09-22 Thread Robert Engels
100% true. The difficulty when examining a “large” system is that it becomes very difficult to understand the relationships. Documentation can help but it is not a great substitute for automated tools. In Java - actually all of OO - type casting is severely frowned upon - but it seems a lot

Re: [go-nuts] understanding interface conversions

2022-09-22 Thread Robert Engels
I struggle with the same in any large project. You have to hope they documented the api very well. Needless to say I’m not a fan of “duck typing”. It makes a few things easier and a lot of important things much harder. > On Sep 22, 2022, at 5:27 PM, Rory Campbell-Lange > wrote: > > This

Re: [go-nuts] cannot convert fs.FS zip file to io.ReadSeeker (missing Seek)

2022-09-21 Thread robert engels
Yea - my bad. Should be fine. > On Sep 21, 2022, at 7:56 PM, 'Dan Kortschak' via golang-nuts > wrote: > > On Wed, 2022-09-21 at 19:30 -0500, robert engels wrote: >> Others have suggested passing a ByteBuffer - I don’t think that will >> work because you will

Re: [go-nuts] cannot convert fs.FS zip file to io.ReadSeeker (missing Seek)

2022-09-21 Thread robert engels
Others have suggested passing a ByteBuffer - I don’t think that will work because you will be missing other methods that are probably needed (FileInfo to get the name, etc) > On Sep 21, 2022, at 7:26 PM, robert engels wrote: > > fs.FS does not support positional reads. It is always t

Re: [go-nuts] cannot convert fs.FS zip file to io.ReadSeeker (missing Seek)

2022-09-21 Thread robert engels
fs.FS does not support positional reads. It is always the entire file. You can create a wrapper struct that implements the Seek() (trivial - just keep a position and adjust Read() accordingly). > On Sep 21, 2022, at 6:58 PM, Rory Campbell-Lange > wrote: > > I have a program that needs to

Re: [go-nuts] Re: Single Job to Multi Job

2022-09-20 Thread Robert Engels
I think you might find it easier to reason about if you think pull rather than push. That is, the client asks the server “do you have a job for me” and the server returns the job. If instead as in your design the server pushes the job to the client it can get real complex (e.g what if the

[go-nuts] [Announce] leveldb in Go

2022-09-18 Thread robert engels
Hi, I am pleased to announce the release of robaho/leveldb It is a key-value store using LSM trees based on my original keydb but has been updated to use an api which is very similar to Google’s C++ LevelDB. It has some features still under development,

Re: [go-nuts] Race detector question

2022-09-16 Thread robert engels
e sequenced-before relationship. The sequenced-before > relationship is *almost* a total order on the execution of a single > goroutine. The only exceptions are weird cases like the order of evaluation > of arguments of a function call, which has some wiggle room in the spec. > Certainly d

Re: [go-nuts] Race detector question

2022-09-16 Thread Robert Engels
lt;0xj...@gmail.com> wrote: > > On Fri, Sep 16, 2022 at 4:42 PM Robert Engels wrote: > >> I don’t know what is happening. The message you just sent came from you not >> the list. This is not how it is supposed to work. That is why there is a >> problem. > > F

Re: [go-nuts] Race detector question

2022-09-16 Thread Robert Engels
rcl <0xj...@gmail.com> wrote: > On Fri, Sep 16, 2022 at 7:43 AM robert engels wrote: > >> After some analysis and discussion, the sample I provided earlier has a data >> race by definition - although in many cases these are benign and do no >> affect the correct

Re: [go-nuts] Race detector question

2022-09-16 Thread Robert Engels
I don’t know what is happening. The message you just sent came from you not the list. This is not how it is supposed to work. That is why there is a problem. > On Sep 16, 2022, at 9:30 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Fri, Sep 16, 2022 at 4:23 PM Rober

Re: [go-nuts] Race detector question

2022-09-16 Thread Robert Engels
Normally when people reply to the list it only comes from the list - and the list is allow listed. You are the first person in years to say anything about this. Sorry. I don’t think there is much I can do except change email addresses to one. Y a different provider. > On Sep 16, 2022, at 3:01

Re: [go-nuts] Race detector question

2022-09-15 Thread robert engels
1) { if y%100 == 0 { fmt.Print("matched") } atomic.StoreInt32(, 0) } } w.Done() }() w.Wait() } > On Sep 15, 2022, at 10:59 AM, Robert Engels wrote: > > I have not misunderstood it. Nor have I misunder

Re: [go-nuts] Race detector question

2022-09-15 Thread robert engels
ve “happens before” semantics with its atomics. > On Sep 15, 2022, at 9:41 AM, Robert Engels wrote: > > To clarify, if the atomic read of Y sees the updated Y then a subsequent > non-atomic read of X must see the updated X. This is a happens before > relationship. > >

Re: [go-nuts] Race detector question

2022-09-15 Thread Robert Engels
To clarify, if the atomic read of Y sees the updated Y then a subsequent non-atomic read of X must see the updated X. This is a happens before relationship. The question was if the race detector understands this - I know - why not try it out… > On Sep 15, 2022, at 9:39 AM, Robert Eng

Re: [go-nuts] Race detector question

2022-09-15 Thread Robert Engels
ues have >> the property you want. And since there is no before relationship established >> by any of the following text, this synchronization cannot be relied on. >> >> Now you're asking whether the race detector ensures the synchronization >> property you

[go-nuts] Re: Race detector question

2022-09-14 Thread robert engels
. The follow-up question still stands. > On Sep 14, 2022, at 10:01 PM, robert engels wrote: > > Hi, > > I am working on a new project, and the race detector is reporting a race. > > Essentially, the code is > > var S []int > > several go routines write new S value

[go-nuts] Race detector question

2022-09-14 Thread robert engels
Hi, I am working on a new project, and the race detector is reporting a race. Essentially, the code is var S []int several go routines write new S values using a mutex go routine Y reads S without grabbing a lock (it reads it initially under lock) The semantics are such that Y can operate

Re: [go-nuts] Is Go a security malware risk?

2022-08-23 Thread Robert Engels
Doesn’t a different structure as per the Go FAQ imply a specialized loader /runtime linker? I just assumed it did. > On Aug 23, 2022, at 1:47 PM, Ian Lance Taylor wrote: > > On Tue, Aug 23, 2022 at 9:29 AM Robert Engels wrote: >> >> I did not read the analysis -

Re: [go-nuts] Is Go a security malware risk?

2022-08-23 Thread Robert Engels
I did not read the analysis - just the thread here and earlier threads on this subject. My understanding that even though Go is statically linked the loader does relocations that confuse virus scanners. > On Aug 23, 2022, at 11:05 AM, Brian Candler wrote: > >  >> On Tuesday, 23 August 2022

Re: [go-nuts] Is Go a security malware risk?

2022-08-23 Thread Robert Engels
I think what is being suggested that if the sec team bans all applications that exhibit dynamic code loading behavior they’d be safer - which would catch a lot of apps in the net. > On Aug 23, 2022, at 10:44 AM, Brian Candler wrote: > >  >> On Tuesday, 23 August 2022 at 15:30:49 UTC+1

Re: [go-nuts] Pipelining with Go and Generics

2022-08-12 Thread Robert Engels
12, 2022, at 4:22 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Thu, Aug 11, 2022 at 11:18 PM Robert Engels wrote: > >> Every modern language with generics or similar has a streams package so >> there’s no need to call out Java. > > For some reason unknown to

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
t; >> On Thu, Aug 11, 2022, 22:37 Robert Engels wrote: >> I don’t think that is relevant. It is very difficult to do chaining with >> Go’s error model. > > > I don't think "Go's error model" is a thing. The language specification does > not mention it a

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
be easier than the current iterator discussion because the options are more limited in how you could do it (without additional language changes) > On Aug 11, 2022, at 3:37 PM, Robert Engels wrote: > >  > I don’t think that is relevant. It is very difficult to do chaining with Go’s > e

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
represented using chains. But like I said, I would use panic/recover in the framework to make it easier. > On Aug 11, 2022, at 3:27 PM, Jan Mercl <0xj...@gmail.com> wrote: > >  > > >> On Thu, Aug 11, 2022, 21:36 Robert Engels wrote: >> I’d say it certainly hig

Re: [go-nuts] Pipelining with Go and Generics

2022-08-11 Thread Robert Engels
I’d say it certainly highlights a problem with Go’s error model. Exceptions would fit nicely here - instead it seems you needed to ignore all error handling - because chaining is impossible with error returns. A streams api with panic/recover is needed. > On Aug 11, 2022, at 12:55 PM, K.

Re: [go-nuts] Preemptive interfaces in Go

2022-08-10 Thread Robert Engels
I would say to temper judgement on both sides. If you’ve ever written or read Go code in an IDE and used “find implementors” you’ve seen the power of interface based design. Sure, you can still do this in Go - kind of - because an implementation may not be by design nor according to the

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread robert engels
100% (the argument is simpler though if you focus on UDP rather than TCP). If you think usecs matter that much you need to be hardware based or you’ve already lost. Most people that are concerned about usecs have other latency killers that are in the 100’s of milliseconds - but they never

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread robert engels
It is probably not the data in the cache - it is the code - whether yours or the kernel. Did you try “hot threading” with polling in the C code? Did you see the same results? Typically a context switch on modern linux is 6 usecs - so I am doubting that is the source of your latency. > On Jul

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread robert engels
Since the net IO is abstracted away from you, the answer is ’not usually’. The usual solution is dedicated threads that constantly poll the sockets, or hardware support + real-time threads, etc. BUT, typically this is not what you are experiencing. More likely, the cpu cache gets cold - so the

Re: [go-nuts] Is there FIX exchange trading server or client simulator project with Go

2022-07-23 Thread Robert Engels
github.com/robaho/go-trader implements a fix connector > On Jul 23, 2022, at 9:24 AM, 'michael yue' via golang-nuts > wrote: > > Is there FIX exchange trading server or client simulator project with Go > -- > You received this message because you are subscribed to the Google Groups >

Re: [go-nuts] Methods of reflect pkg use mostly panic instead of return error. Why so?

2022-07-20 Thread Robert Engels
Which is also the distinction between checked and unchecked exceptions. Checked exceptions force the caller to deal with potential errors and are harder to ignore than error codes. > On Jul 20, 2022, at 3:52 PM, 'Axel Wagner' via golang-nuts > wrote: > >  > The reason reflect uses panic,

Re: [go-nuts] Do I need a reentrant locks?

2022-07-06 Thread Robert Engels
Depends on if you “concurrent” readers or serialized interlaced ones. It depends on you transaction semantics - eg dirty reads, etc. It is fairly easy for readers to grab the read lock and the writer thread (since they were added to a queue) to grab the write lock when it has work to do.

Re: [go-nuts] Do I need a reentrant locks?

2022-07-05 Thread robert engels
I would put all of the mutations on a queue so they are single threaded. > On Jul 5, 2022, at 9:51 AM, robert engels wrote: > > This is a recipe for bad bugs. Use defensive programming - grab the lock in > the top-level functions, have private functions like ‘doWithLock()’ as

Re: [go-nuts] Do I need a reentrant locks?

2022-07-05 Thread robert engels
This is a recipe for bad bugs. Use defensive programming - grab the lock in the top-level functions, have private functions like ‘doWithLock()’ as a signal to the developer that they must be holding the lock. Allowing callbacks to call back into a concurrent safe structure is very

Re: [go-nuts] ListenAndServeTLS() (pem and key files for private network)

2022-06-30 Thread Robert Engels
gt; to use client certificates instead? > >> On 6/30/22 16:29, Hugh Myrie wrote: >> Your help is much appreciated. Security is of paramount importance so I must >> take everything into consideration. I am learning so feel free to provide >> useful feedback. >&g

Re: [go-nuts] ListenAndServeTLS() (pem and key files for private network)

2022-06-30 Thread Robert Engels
free to provide > useful feedback. > >> On Thu, Jun 30, 2022 at 7:22 AM Robert Engels wrote: >> I don’t think it needs to be that complicated just load the client public >> certs into the server. Validate upon usage that the cert is still valid. >> Easy to authent

Re: [go-nuts] ListenAndServeTLS() (pem and key files for private network)

2022-06-30 Thread Robert Engels
I don’t think it needs to be that complicated just load the client public certs into the server. Validate upon usage that the cert is still valid. Easy to authenticate clients this way. This is how ssh works with certificate based authentication. Peer to peer is a little harder but usually you

Re: [go-nuts] Setting a cookie - Expires needed with MaxAge?

2022-05-18 Thread Robert Engels
So sorry - didn’t look at the api just assumed. Apologies. > On May 18, 2022, at 4:48 PM, Amit Saha wrote: > >  > > > On Thu, May 19, 2022 at 7:43 AM Robert Engels wrote: > > > > Your first case doesn’t even work - nil is output. > > > That's a

Re: [go-nuts] OAuth2 HttpClient customizable header

2022-05-18 Thread Robert Engels
If it is implemented correctly oauth2 is a standard that uses a Bearer token. Not sure if the other auth-scheme are usable - then it wouldn’t be oauth. Sounds like you either need an additional routing header or a different auth-scheme > On May 18, 2022, at 3:09 PM, 'Sean Liao' via

Re: [go-nuts] Setting a cookie - Expires needed with MaxAge?

2022-05-18 Thread Robert Engels
Your first case doesn’t even work - nil is output. > On May 18, 2022, at 4:11 PM, Amit Saha wrote: > >  > Hi all, > > For a cookie, it seems like both, `Expires` and `MaxAge` must be specified? > The expectation is that, only Max-Age should be sufficient. > > // valid > c1 := http.Cookie{

Re: [go-nuts] HTTP2 client sending RST_STREAM to Netty server

2022-05-16 Thread Robert Engels
t;>>> the log line does not contain any such extra information about "omitting >>>> bytes" from the log. >>>> I am wondering if my client failed to upload the entire JSON payload and >>>> hence this caused it to timeout waiting

Re: [go-nuts] Processor cores

2022-05-15 Thread robert engels
No it does not. See runtime/proc.go if you want to learn more. > On May 15, 2022, at 5:28 PM, Tharaneedharan Vilwanathan > wrote: > > Hi All, > > I have a quick question about processor core usage. > > Many processors like ARM, Apple and Intel have performance and efficiency > cores. Does

Re: [go-nuts] HTTP2 client sending RST_STREAM to Netty server

2022-05-10 Thread robert engels
Conn.Error() should give you the underlying error as well. > On May 10, 2022, at 7:47 AM, robert engels wrote: > > I would add some logging to > > func (cs *clientStream) cleanupWriteRequest(err error) > > but you should be getting the underlying error when you perf

Re: [go-nuts] HTTP2 client sending RST_STREAM to Netty server

2022-05-10 Thread robert engels
022, at 6:59 AM, Robert Engels wrote: > > Set a breakpoint on the RST_STREAM generation and run under the debugger. > >> On May 10, 2022, at 4:18 AM, envee wrote: >> >> Hi All, I am using a Go HTTP/2 client (no SSL) to send requests at the rate >> of arou

Re: [go-nuts] HTTP2 client sending RST_STREAM to Netty server

2022-05-10 Thread Robert Engels
Set a breakpoint on the RST_STREAM generation and run under the debugger. > On May 10, 2022, at 4:18 AM, envee wrote: > > Hi All, I am using a Go HTTP/2 client (no SSL) to send requests at the rate > of around 3000 transactions per second (TPS) to a Web-server which is based > on Netty. >

Re: [go-nuts] Scheduler prioritization on time sensitive routines?

2022-05-08 Thread Robert Engels
No. Go has not knowledge of priority. It does do preemption. > On May 8, 2022, at 3:24 PM, TH wrote: > > Hey, > > I have few time sensitive functions that are being executed from multiples > goroutines. I'm trying to minimize latency, or make the latency more > consistent. (Not using RT

Re: [go-nuts] Which is the most efficient way to read STDIN lines 100s of MB long and tens of MB info is passed to it

2022-05-08 Thread Robert Engels
Way over complicating this. Use a buffered reader. Keep track of the position the last newline was seen. It is a trivial state machine the find ‘test’ continue to next newline. Seek to stored last newline position and buffered read and write to stdout until next newline. > On May 8, 2022,

Re: [go-nuts] Are pointers guaranteed to keep the entire pointee alive?

2022-05-07 Thread Robert Engels
The code is not compliant with the rules T2 is larger than T1 and no guarantee of the same layout either. > On May 7, 2022, at 7:54 AM, 'Axel Wagner' via golang-nuts > wrote: > >  > >> On Sat, May 7, 2022 at 1:20 PM Jan Mercl <0xj...@gmail.com> wrote: >> ^ Breaking the unsafe rules enables

Re: [go-nuts] Re: GO program's memory footprint is confusing

2022-05-06 Thread Robert Engels
https://www.arp242.net/static-go.html > On May 5, 2022, at 11:27 PM, garenchan wrote: > > The binary file is not a dynamic executable. So I don't think that will > happen. > > 在2022年5月6日星期五 UTC+8 11:54:44 写道: >> Are you certain that on the low memory instance there isn’t another process

Re: [go-nuts] Re: GO program's memory footprint is confusing

2022-05-05 Thread Robert Engels
Are you certain that on the low memory instance there isn’t another process - maybe Go - that hasn’t already loaded the shared libraries - and on the other it hasn’t - so the RSS is different. Compare the VSZ sizes and see if they are the same. > On May 5, 2022, at 10:28 PM, garenchan wrote:

Re: [go-nuts] Re: A patch to avoid point-time race coincidence like Rust

2022-05-05 Thread Robert Engels
You might find https://github.com/robaho/go-concurrency-test of interest. The channel based solution to concurrency is only suitable imo for apps with minimal concerns around its performance - ie low usage, low contention but it is often easier to get right by people not familiar with

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Robert Engels
omparison could be a method, but an Equals() method would be left > out to be consistent with how it is today. > >> On Wed, May 4, 2022 at 5:22 AM Robert Engels wrote: >> Seems easier to move to a Go without operators and do everything with >> functions and gener

Re: [go-nuts] Add comparisons to all types

2022-05-04 Thread Robert Engels
Seems easier to move to a Go without operators and do everything with functions and generics. This is essentially the Java model. This is pretty much the approach that the sync, sort, etc packages took and with generics you can have type safety and less code duplication. > On May 4, 2022, at

Re: [go-nuts] Re: Windows Binaries and stdout

2022-05-02 Thread Robert Engels
https://www.tillett.info/2013/05/13/how-to-create-a-windows-program-that-works-as-both-as-a-gui-and-console-application/ > On May 2, 2022, at 8:27 AM, 'Anderson Queiroz' via golang-nuts > wrote: > > You could log to a file. If you're willing to take in a -log flag, you could > take a path as

Re: [go-nuts] Any recipe to stop a goroutine of a function other than of a channel?

2022-04-16 Thread Robert Engels
2 options: put a timeout on the listen and loop. Close the socket it is listening on. > On Apr 16, 2022, at 8:30 AM, Zhaoxun Yan wrote: > >  > Timeout is quite common practice in programming. For example, Listen > function in internet connection with a timeout may just close the connection

Re: [go-nuts] Protective buffered channel that never triggers deadlock

2022-04-13 Thread Robert Engels
that the leaky buffer example does not spin / busy wait) > On Apr 13, 2022, at 4:44 AM, Robert Engels wrote: > >  > Adding to a full buffered channel will not cause a crash. It can deadlock > just as the unbuffered can - but the deadlocks can be harder to diagnose. > >>&g

Re: [go-nuts] Protective buffered channel that never triggers deadlock

2022-04-13 Thread Robert Engels
Adding to a full buffered channel will not cause a crash. It can deadlock just as the unbuffered can - but the deadlocks can be harder to diagnose. > On Apr 13, 2022, at 3:40 AM, Zhaoxun Yan wrote: > >  > Since I found if inserting into a buffered channel could cause a crash if it > is full

Re: [go-nuts] Why Go has only slice and map

2022-04-12 Thread Robert Engels
Nit but you can certainly create maps and slices in a library - you use methods not language syntax - as long as you have pointers and type casting. > On Apr 12, 2022, at 1:30 PM, Jesper Louis Andersen > wrote: > >  >> On Tue, Apr 12, 2022 at 8:19 AM 'Jack Li' via golang-nuts >> wrote: >>

Re: [go-nuts] Hesitating on using cached / un-cached channels

2022-04-11 Thread robert engels
There are numerous ways to create a “dead lock” in any program (this may actually be a “live lock” but I didn’t fully understand your statement - this is just one of them. > On Apr 11, 2022, at 9:29 PM, Zhaoxun Yan wrote: > > Hi guys, I have a great demonstration on why an un-cached channel

Re: [go-nuts] float exactness

2022-04-09 Thread Robert Engels
There are several. See github.com/robaho/fixed As to why, read up on numerical analysis. It’s an interesting topic. > On Apr 9, 2022, at 8:56 AM, 'Jack Li' via golang-nuts > wrote: > >  > Hi group, > > 1. > Is there a package can do exact float operations, like Decimal in Python? For >

Re: [go-nuts] Handle 1 million concurrent connections with 50 lines Go code

2022-04-06 Thread Robert Engels
Yes. Go uses “green threads” with its own scheduler and uses facilities like epoll under the covers. > On Apr 6, 2022, at 8:43 AM, 'Jack Li' via golang-nuts > wrote: > >  > Hi group, > > I am going through this page: https://studygolang.com/articles/22820 , It > claims that the 50 lines

Re: [go-nuts] Allow a TCP connection, but not a TLS connection based on an ACL

2022-03-28 Thread robert engels
Ignore that last part - just use a “temporary” error. > On Mar 28, 2022, at 5:46 PM, robert engels wrote: > > You just need to return a temporary error. It should not be exiting anyway - > unless the “done” channel is valid. > > ctx := context.WithValue(baseCtx, Ser

Re: [go-nuts] Allow a TCP connection, but not a TLS connection based on an ACL

2022-03-28 Thread robert engels
You just need to return a temporary error. It should not be exiting anyway - unless the “done” channel is valid. ctx := context.WithValue(baseCtx, ServerContextKey, srv) for { rw, err := l.Accept() if err != nil { select { case <-srv.getDoneChan(): return

Re: [go-nuts] Investigating suspected memory leak based on StackInUse or HeapSys stats

2022-03-27 Thread robert engels
eapAlloc and pprof? > > On Sun, Mar 27, 2022, 18:52 robert engels <mailto:reng...@ix.netcom.com>> wrote: > Neither of those track C allocations - unless the C is calling back into Go. > > You can review the low level usage in stack.go > > Note that Go stack al

Re: [go-nuts] Investigating suspected memory leak based on StackInUse or HeapSys stats

2022-03-27 Thread robert engels
'll move on and start chasing C code (Possibly using Valgrind? Can I > use it to profile my Go application with Cgo?) > > On Sat, Mar 26, 2022, 22:54 robert engels <mailto:reng...@ix.netcom.com>> wrote: > Are you certain your CGo code isn’t creating threads? > >>

Re: [go-nuts] Investigating suspected memory leak based on StackInUse or HeapSys stats

2022-03-26 Thread robert engels
Are you certain your CGo code isn’t creating threads? > On Mar 26, 2022, at 1:10 PM, Shlomi Amit wrote: > > Yes. I already monitoring the runtime stat of number of go routines (Can be > seen in the screenshot as well) and it's not increasing. > > On Sat, Mar 26, 2022, 2

Re: [go-nuts] Investigating suspected memory leak based on StackInUse or HeapSys stats

2022-03-26 Thread robert engels
Are you certain the number of Go routines is not increasing - each Go routine requires stack. See https://tpaschalis.github.io/goroutines-size/ > On Mar 24, 2022, at 3:18 PM, Shlomi Amit wrote: > > Hi. > > I’m trying to find a memory leak in my application. > I’ve added some runtime memory

Re: [go-nuts] Race detector compatible ring buffer Part II

2022-03-11 Thread Robert Engels
Btw, for those interesting in some neat highly optimized queue patterns check out https://lmax-exchange.github.io/disruptor/ > On Mar 11, 2022, at 5:58 PM, Robert Engels wrote: > >  > “Usually” SPSC means it is optimized for that case but it doesn’t fail in > case of m

Re: [go-nuts] Race detector compatible ring buffer Part II

2022-03-11 Thread Robert Engels
“Usually” SPSC means it is optimized for that case but it doesn’t fail in case of multiple writers. It it usually easier to prevent multiple readers as the reader can be controlled during init and hidden. > On Mar 11, 2022, at 4:41 PM, 'Axel Wagner' via golang-nuts > wrote: > >  > > >>

Re: [go-nuts] Re: Pod memory keeps on increasing and restart with error OOMKilled

2022-03-11 Thread Robert Engels
I think your best course of action is to go to the Kafka forums. > On Mar 10, 2022, at 10:12 PM, Rakesh K R wrote: > > Hi, > Thank you. I know its kafka related question but thread started with issue in > golang but later we are suspecting issue in go kafka library configuration. > FYI, I am

Re: [go-nuts] Re: Pod memory keeps on increasing and restart with error OOMKilled

2022-03-10 Thread Robert Engels
Look at log.retention.hours and log.retention.bytes You should post this in the Kafka forums not the Go ones. > On Mar 10, 2022, at 11:04 AM, Rakesh K R wrote: > > Hi, > Sorry I am not sure which kafka configuration are you referring here. Can you > please point me to the right

Re: [go-nuts] Re: Pod memory keeps on increasing and restart with error OOMKilled

2022-03-10 Thread Robert Engels
You need to configure Kafka for how long it retains messages for replay - or some other option to store on disk. > On Mar 10, 2022, at 10:07 AM, Rakesh K R wrote: > > Tamas, > Thanks you. So any suggestion on how to make application release this 900MiB > memory back to OS so that pod will

Re: [go-nuts] Re: Possible float64 precision problem

2022-03-09 Thread Robert Engels
You will need to provide the C compiler used and the flags. See https://stackoverflow.com/questions/38815823/compiler-flags-for-enhancing-the-precision-of-intermediate-floating-point-calcul > On Mar 9, 2022, at 6:46 AM, Sean Liao wrote: > > It would help if your could show the actual code for

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

2022-03-01 Thread Robert Engels
Yea - argument doesn’t hold much water. Log files either use timezonr agnostic times or the users know they will change if the time zone changes. > On Mar 1, 2022, at 6:05 PM, Carl wrote: > > I'm interested in the reason for the current behaviour. > I know there are ways to work around it

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

2022-03-01 Thread Robert Engels
Have a background routine that polls the os every N secs - but the OP can do that themselves. > On Mar 1, 2022, at 5:32 PM, Kurtis Rader wrote: > >  >> On Tue, Mar 1, 2022 at 2:55 PM Carl wrote: > >> I would like to understand the reasoning for the implementation, if >> possible. >> >>

Re: [go-nuts] how cgo handle user define signal ? need go pass the signal handle to c

2022-02-28 Thread Robert Engels
Should be pretty easy to have a Go routine blocked in a C call waiting - then have the signal handler add an event to a memory queue and wake the C thread. Then dispatch to a Go side handler. > On Feb 28, 2022, at 1:49 PM, Ian Lance Taylor wrote: > > On Mon, Feb 28, 2022 at 5:08 AM LordRusk

Re: [go-nuts] are Go generics more like C++ or more like Java?

2022-02-27 Thread robert engels
. Being able to turn knobs on these decisions will be critical to achieving optimal overall application performance. > On Feb 27, 2022, at 12:03 PM, 'Axel Wagner' via golang-nuts > wrote: > > On Sun, Feb 27, 2022 at 6:33 PM robert engels <mailto:reng...@ix.netcom.com>>

Re: [go-nuts] are Go generics more like C++ or more like Java?

2022-02-27 Thread robert engels
I disagree that it wont be formally published - or at least have knobs to turn to control it - otherwise it will be nearly impossible to make the determination of when your generic’s usage will result in a performance penalty. This probably won’t matter for 95% of the code - but it if does

<    1   2   3   4   5   6   7   8   9   10   >