[go-nuts] The possibilty run go source code as real scripts

2024-11-22 Thread Lin Lin
Hi, gophers, here is our dilemma. We build system managing infrastructure such as Kubernetes. With that comes the need to write a lot of maintenance scripts. For now they are all written in Bash, which is hard to edit and test. As the community suggests, do not write Bash code more than 100 lin

Re: [go-nuts] Is it possible to compile a Go program without jump tables ?

2024-11-28 Thread Lin Lin
I assume you can rewrite the code from switch to if/else before compiling with go/ast package. If that is not your case, hacking the go compiler is a harder solution, you probably don't want to do that. On Thu, 28 Nov 2024 at 17:12, 'Karolina GORNA' via golang-nuts < golang-nuts@googlegroups.com>

Re: [go-nuts] query for runtime.reportZombies data race PoC code

2024-11-18 Thread Lin Lin
aceback should provide a clue regarding the nature of the race > sufficient to identify the problem. > > A proof of concept (PoC) illustrating a data race is easy to write. But a > generic data race PoC is unlikely to help you solve the problem with your > code. > > On

[go-nuts] Re: HTTP requests to a headless k8s service not getting load balanced with go1.22.7

2024-11-18 Thread Lin Lin
I've ran some tests as follow, failed to see the load balancing in both go1.22 and go1.23. 1. setup a coredns to provide dns service. 2. assign additional IP to the NIC. 3. run 2 http server with flask on each IP address. 4. using http.client to request that server. So I dout if that is a Go be

[go-nuts] query for runtime.reportZombies data race PoC code

2024-11-18 Thread Lin Lin
Hi, gophers Quite a few issues like https://github.com/golang/go/issues/47513 are caused by DATA RACE. I myselft also ran into one in Go1.17, and data race can be found in the code. But I'm unable to reproduce the issue stably, as I need to some PoC code to make the managers to believe it's cau

Re: [go-nuts] query for runtime.reportZombies data race PoC code

2024-11-19 Thread Lin Lin
took the wrong direction, this could be a hardware issue, like a memory bit flip? But I failed to find any issue in the Go community. On Tue, 19 Nov 2024 at 14:32, Kurtis Rader wrote: > On Mon, Nov 18, 2024 at 10:06 PM Lin Lin > wrote: > >> Yes, I do agree that it's eas

Re: [go-nuts] query for runtime.reportZombies data race PoC code

2024-11-19 Thread Lin Lin
Ian, thanks for your explanation, it really shed light on that for me. I certainly will fix the data race. Thanks to all for your time. On Tue, 19 Nov 2024 at 22:46, Ian Lance Taylor wrote: > On Tue, Nov 19, 2024 at 3:50 AM Lin Lin wrote: > > > > Thanks for your kind an

Re: [go-nuts] Re: The possibilty run go source code as real scripts

2024-11-24 Thread Lin Lin
Thanks Brian. I've checked that, it probably what I want. I don't know how I missed it. Thanks again. On Sun, 24 Nov 2024 at 05:59, 'Brian Candler' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Have you looked at this? > > https://github.com/traefik/yaegi?tab=readme-ov-file#as-a-comma

Re: [go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread Lin Lin
Hi, David, I'm no expert on http std. But the following testcase based on the httptest unittest code works. I think the key point is to use ' client.Get(server.URL)' to invoke a request. Hope it helps. import "testing" import "os" import "net/http" import "net/http/httptest" func TestProcessProj

Re: [go-nuts] why url.Parse return err=nil with an apparently invalid URL

2025-02-23 Thread Lin Lin
Thanks a lot for the powerful and detailed explanation, Dan. Though one surely needs to be careful when coding, I'm keeping my initial point to improve the document or any improvements like Robert suggested as below. > developers shouldn’t have to read the code to understand the invariants of an

[go-nuts] why url.Parse return err=nil with an apparently invalid URL

2025-02-20 Thread Lin Lin
.Parse is hidden inside, which is even less likely to be noticed. I've seen issues below, they were closed. https://github.com/golang/go/issues/35245 https://github.com/golang/go/issues/54689 Maybe we can improve that. Thanks for your time, best regards. Lin Lin -- You received this

[go-nuts] Looking for a way letting gopls ignore the _test.go files

2025-05-27 Thread Lin Lin
Hi, gophers When reading Go code, one always needs to find the references of a function or a constant. Those references in the _test.go can be very noisy. I'll be great if there is a way to let gopls ignore those files. I failed to find such a way or configuration in gopls. I've learned that gop