[go-nuts] Re: GC hint for collection timing

2025-02-27 Thread Amnon
Go nearly had Arenas a few years ago. And I think they are still used in Google. But they were pulled because the polluted the API's of too many libraries. See https://github.com/golang/go/issues/51317 On Thursday, 27 February 2025 at 07:55:27 UTC will@gmail.com wrote: > I recently recalled t

Re: [go-nuts] Is it necessary to change the behavior of maps.Keys and maps.Values?

2024-12-28 Thread Amnon
A nice thing about Go is that it is easy on the eye. Names are short, and easy to read. When you look at Go code, you are not faced with a wall of black text. The signal to noise ratio is high. Variable and function names general convey what they do, what they mean, rather than the types of thei

Re: [go-nuts] Is it necessary to change the behavior of maps.Keys and maps.Values?

2024-12-28 Thread Amnon
There are big advantages in maps.Keys and maps.Values returning iterators. It allows us to iterate very big maps without having to allocate vast amounts of memory. When maps was moved from x/exp to the standard library, the Keys and Values methods were not added until 1.23.0 when iterators beca

Re: [go-nuts] Issue with CGO and GOGC when dealing with large buffers

2024-12-02 Thread Amnon
Why are you using CGO? Why not just make life easy for yourself by sticking to the http.ServeTLS built in to the Go standard library. On Monday, 2 December 2024 at 19:25:21 UTC Ian Lance Taylor wrote: > On Mon, Dec 2, 2024 at 11:16 AM Jason E. Aten wrote: > > > > ChatGPT seems to think that the

Re: [go-nuts] Golang career

2024-11-06 Thread Amnon
You will probably be able to learn Go in a week. On Wednesday 6 November 2024 at 05:00:33 UTC Rodrick Brown wrote: > I learned go in 1 year at 40 and Rust at 44 go figure 🤣😂 and I'm 45 now > > On Tue, Nov 5, 2024 at 5:20 PM Vinicius Fernandes > wrote: > >> Hello, everyone! I hope you are all

[go-nuts] Why is go vet slow

2024-09-30 Thread Amnon
go vet ./... has recently become very slow on my company's code-base taking 20s to complete. Is there an easy way I can get some feedback over what in my code-base is making go vet slow? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubs

[go-nuts] any plans to add a go1.23 iterator to sync.Map?

2024-08-21 Thread Amnon
It would be cool to replace our m.Range() calls with plain for-loops. -- 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+unsubscr...@googlegroups.com. To

Re: [go-nuts] Re: After Disbanding the Python Team, Google’s Go Team Faces Turmoil: Technical Lead and 12-Year Project Leader Steps Down

2024-08-15 Thread Amnon
That is a high bar! rsc, thanks for the great leadership and clarity over the past decade+! And best of luck to Austin... On Thursday 15 August 2024 at 18:14:44 UTC+1 Russ Cox wrote: > Hi all, > > There is no need for this discussion to get heated. > There is also no turmoil, as we've already es

Re: [go-nuts] After Disbanding the Python Team, Google’s Go Team Faces Turmoil: Technical Lead and 12-Year Project Leader Steps Down

2024-08-15 Thread Amnon
Thanks, Ian for putting our minds to rest. On Thursday 15 August 2024 at 17:11:41 UTC+1 Ian Lance Taylor wrote: On Thu, Aug 15, 2024 at 1:10 AM 'Axel Wagner' via golang-nuts wrote: > > The facts of the title are correct. See here: > https://techcrunch.com/2024/05/01/google-lays-off-staff-fr

[go-nuts] After Disbanding the Python Team, Google’s Go Team Faces Turmoil: Technical Lead and 12-Year Project Leader Steps Down

2024-08-14 Thread Amnon
https://blog.stackademic.com/after-disbanding-the-python-team-googles-go-team-faces-turmoil-12-year-project-leader-steps-down-29c4248ceb85 I could not read this article as it is behind a pay-wall. But the title looks interesting, (and worrying if correct). -- You received this message because yo

[go-nuts] Re: Guidance on techniques that can help me write a comprehensive test for my go library.

2024-06-07 Thread Amnon
https://research.swtch.com/testing On Friday 7 June 2024 at 14:26:35 UTC+1 Guilherme Henrique wrote: > You want to make a mock of the Google API calls, the same ones you use in > your project, and that's it? > > Em quarta-feira, 5 de junho de 2024 às 10:41:03 UTC-3, Ai Readone escreveu: > >> Hel

Re: [go-nuts] Re: Range over int

2024-02-23 Thread Amnon
You just needed to wait around for a 12 years. Because you were just ahead of your time And if you are reading these lines, please post again to give us a glimpse of what new features we should expect to be added to Go in 2036... - amnon On Saturday 24 February 2024 at 01:20:04 UTC Dunca

Re: [go-nuts] heap pprof profile showing only 10Gi out of 50Gi of actually used memory

2024-02-21 Thread Amnon
Worth studying https://tip.golang.org/doc/gc-guide The heap profile will show you the heap memory in use, but the OS process info will tell you the total process size, including memory in use, and memory GC which has been marked as free and reclaimed by the GC, but not relinquished to the OS. Wh

Re: [go-nuts] Re: Range over int

2024-02-16 Thread Amnon
Indeed. The thread started 12 years ago. At the time I thought the idea of ranging over an int was just dumb, and un-go-like. But now it is out, I think it is great, and have run perl -pi -e 's/for (\w+) := 0; \1 < ([\w()]+); \1\+\+/for \1 := range \2/' $(git grep -l for) over my entire code

[go-nuts] remove pre-1.22 cruft

2024-02-15 Thread Amnon
Now that 1.22 is out, is there an easy way to remove pre-1.22 cruft, like x := x assignments inside loops. -- 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

[go-nuts] Go 1.22 code simplification

2024-01-15 Thread Amnon
Go 1.22 contains some cool features which will allow us to write simpler code. Would it be possible for gofmt -s to help us do transformations which clean up old code such as for i := 0; i < n; i++ -> for i := range n removing x := x assignments inside range loops or updating code to use the

Re: [go-nuts] Re: does anyone have an example of a Go kernel module

2024-01-14 Thread Amnon
Why would you want to do that? The amount of stuff going on under the hood in a Go program (GC, scheduling, etc) make it a bad fit for low level kernel stuff. So best stick to C. Writing a Kernel module in C is well supported and documented. Having a skim through https://lwn.net/Kernel/LDD3/ .

[go-nuts] Re: [ANN] go-zeromq/zmq4: pure-Go implementation of ZeroMQ

2023-08-23 Thread Amnon
decide to go down the CGO route? - Amnon On Thursday, 14 June 2018 at 08:30:39 UTC+1 Sokolov Yura wrote: > Great! It is really long waited. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and s

Re: [go-nuts] Best IDE for GO ?

2023-08-20 Thread Amnon
IDE is indeed a personal choice. The Go developer survey often asks which IDE people use. Last year, the favourite was VS code with 45% of users, followed by Goland with 34%. On Sunday, 20 August 2023 at 17:38:26 UTC+1 burak serdar wrote: > On Sun, Aug 20, 2023 at 1:52 AM TheDiveO wrote: > >> w

Re: [go-nuts] I need confirmation about whether I'm in front of a linter false positive.

2023-08-15 Thread Amnon
I would stop using that particular linter. And keep calling your error value err. It is idiomatic. On Monday, 14 August 2023 at 22:36:11 UTC+1 David Finkel wrote: > On Mon, Aug 14, 2023 at 4:54 PM Pablo Caballero wrote: > >> I started working on a Golang project (from my work). The following

Re: [go-nuts] Please consider voting to reopen Golang subreddit

2023-06-23 Thread Amnon
Sorry, but I have been away and missed the context. What is the protest about? What has redit changed? Thanks On Saturday, 24 June 2023 at 06:07:38 UTC+1 Axel Wagner wrote: > On Sat, Jun 24, 2023 at 3:03 AM cpa...@gmail.com wrote: > >> If 100 people are on a boat and 51 want to sink the boat

Re: [go-nuts] Re: 'go run hello.go' taking ~30 seconds on windows

2023-06-22 Thread Amnon
Someone should publish a benchmark of compiling Go code on Windows, Linux, osX. People can take this into account when selecting their development platform. And if enough people complain about Windows machines being several orders of magnitude slower than similar priced competing platforms, then

Re: [go-nuts] Re: Home directory?

2023-04-23 Thread Amnon
: > On Sun, Apr 23, 2023 at 10:28 AM Amnon wrote: > > > Yes GOPATH and GOROOT have been deprecated. > > Both are alive and well. They are essential for the build system/go > command to work as required. > > tl;dr: There's a default value of GOPATH so one does not

[go-nuts] Re: Home directory?

2023-04-23 Thread Amnon
I looked at https://go.dev/doc/tutorial/create-module it only has two mentions of, which are just suggestions regarding where to create your working directory. But it is just a suggestion, and you can choose any location which is convenient for you. Yes GOPATH and GOROOT have been deprecated.

Re: [go-nuts] Redfining loop variable semantics - what's the plan?

2023-03-25 Thread Amnon
Thanks for a very succinct response. So if I understand the CL, there will be no change in behaviour in 1.21, unless you set GOEXPERIMENT=loopvar - Amnon On Saturday, 25 March 2023 at 06:56:23 UTC Sean Liao wrote: > https://go.dev/issue/57969 > > - sean > > On Sat, Mar 25, 20

[go-nuts] Redfining loop variable semantics - what's the plan?

2023-03-24 Thread Amnon
Hi Gophers, Last year there was a discussion about removing one of the more common gotchas in Go. To quote from the discussion: the problem is that loops like this one don’t do what they look like they do: var all []*Item for _, item := range items { all = append(all, &item) } That is, this

Re: [go-nuts] HTTP client - streaming POST body?

2023-03-06 Thread Amnon
As Bruno said. Try something like this: func uploadBig(url string ) error { file, err := os.Open("bigfile.txt") if err != nil { return err } defer file.Close() resp, err := http.Post(url, "text/plain", file) if err != nil { return err } defer resp.B

[go-nuts] Re: Reading .xls file with golang

2023-02-15 Thread Amnon
File an issue at https://github.com/extrame/xls/issues and maybe submit a fix? On Wednesday, 15 February 2023 at 03:22:30 UTC Aadi Sharma wrote: > While reading .xls file with golang using *ReadAllCells *function from > xls package > https://github.com/extrame/xls/blob/v0.0.1/workbook.go#L268

Re: [go-nuts] Linting

2022-12-14 Thread Amnon
t does, > then it is still the ideal time to rewrite it a bit. > > But perhaps I'm just a sucker for quality and maintainability and I'm > barking up the wrong tree. > I very much want Go to survive, so for me that means that people should > not be afraid to main

Re: [go-nuts] Linting

2022-12-14 Thread Amnon
This long discussion started with the question why the Go source is not linted. But I think the OP has answered his own question by providing us with a list of 963 places where the linter has decided that the code is deficient. But what is notable, is that he has not given a single example whe

Re: [go-nuts] Which websockets implementation

2022-12-12 Thread Amnon
for > an example. > > On Dec 12, 2022, at 12:57 PM, Amnon wrote: > > Which websocket implementation would people recommend for a new project, > > > now that gorilla/websocket has been archived? > > -- > You received this message because you are subscribed to the

[go-nuts] Which websockets implementation

2022-12-12 Thread Amnon
Which websocket implementation would people recommend for a new project, now that gorilla/websocket has been archived? -- 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

Re: [go-nuts] Linting

2022-12-11 Thread Amnon
If you want, run any linters of your chosing on the Go standard library, go through the reports, and see if any are valid - which expose real problems, then feel free to report them here, or submit bug reports. On Sunday, 11 December 2022 at 10:03:21 UTC marc...@gmail.com wrote: > Ok, but does

[go-nuts] Re: Go 1.17.1 runtime seems retain too much memory from OS

2022-11-23 Thread Amnon
Have a look at https://tip.golang.org/doc/gc-guide and https://opensourcelive.withgoogle.com/events/go-day-2022/watch?talk=talk4 On Thursday, 24 November 2022 at 05:08:55 UTC Zhao Weng wrote: > [image: memory.jpg] > memstats show heapIdle - heapReleased > heapAlloc or heapInUse > > I try to sea

Re: [go-nuts] Problems with array slicing reliability?

2022-11-23 Thread Amnon
As others have said, it is worth trying to reduce the program to the minimal version which reproduces your problem (and then publishing it on https://go.dev/play/ ). On Thursday, 24 November 2022 at 02:38:30 UTC kra...@skepticism.us wrote: > You cannot mutate strings. Your code is also missing

[go-nuts] Re: Building a Package With Multiple Subdirectories?

2022-11-22 Thread Amnon
Don't do it. Don't fight the Go tools. Use them the way they are intended. They are your friends. Put all your package files in a single directory. Or break them up into multiple packages. That is the way everyone else write Go. If you follow the convention, your life will be simpler, and your c

[go-nuts] Re: Go 1.20 release date

2022-11-22 Thread Amnon
Feb 2023 is a good bet. On Tuesday, 22 November 2022 at 10:24:07 UTC piotr.w...@gmail.com wrote: > Hi, > > is the date of the 1.20 release roughly known? I need some goodies it > promises to provide. > > Best regards, Piotr > -- You received this message because you are subscribed to the

Re: [go-nuts] Goroutine to thread mapping

2022-11-07 Thread Amnon
Go makes no guarantees about the affinity between goroutines and threads, and the mapping does typically jump around a lot during the execution of a program. On Monday, 7 November 2022 at 17:46:42 UTC ren...@ix.netcom.com wrote: > Do you mean Go assembly or an assembly function called via CGo?

Re: [go-nuts] What is the best way to write MarshalBinary if the data is a sequence of ints

2022-10-23 Thread Amnon
What is best depends on what you want to achieve. Do you want the most compact encoding? Or the fastest encoding? Or the encoding which is easiest to debug? Or the simplest encoding? Or an encoding which allows you to gracefully add fields to the type as your program evolves without invalidating

[go-nuts] Re: Replace reference path

2022-10-21 Thread Amnon
try https://pkg.go.dev/golang.org/x/tools/cmd/gomvpkg On Friday, 21 October 2022 at 16:58:57 UTC+1 mr@gmail.com wrote: > I'm looking for a tool like this, I've searched google and github and > can't find one, have you guys used such a tool? > > I use a method like this in my code > > k8s.io

[go-nuts] Re: Facing issues while using builtin functions while executing golang templates

2022-10-20 Thread Amnon
Unrelated. But it may be worth updating to Go 1.19 as Go 1.15 over 2 years old, and no longer supported. To get an answer to your original question, I would post a code snippet here which reproduces the problem. Also, do you know what triggers this error condition? On Thursday, 20 October 2022

[go-nuts] Re: go runtime in shared libs functions called in threads

2022-10-19 Thread Amnon
Each thread has its own stack, but little else. On Wednesday, 19 October 2022 at 14:28:20 UTC+1 pe...@wonderland.org wrote: > I have built a shared lib in Go to replace an old thing we use to send > email - mainly to modernise things and add TLS and authentication. We run > each call to the ent

[go-nuts] Re: GO API to upload a directory in the github

2022-09-27 Thread Amnon
Have a look at https://github.com/go-git/go-git On Wednesday, 28 September 2022 at 05:46:29 UTC+1 princ...@gmail.com wrote: > HI Everyone, > I want to write an go script, to upload a folder in the github. Can anyone > please let How I can do this. Is there any resources available for this. > Pl

[go-nuts] Re: Using golang variable in bash script Command

2022-09-19 Thread Amnon
What happens if the user enters the string "'; rm -fr ~;'" ? On Monday, 19 September 2022 at 13:25:31 UTC+1 Brian Candler wrote: > On Monday, 19 September 2022 at 10:50:36 UTC+1 princ...@gmail.com wrote: > >> >> *search:=scanner.Text()cmd1,err:=exec.Command("bash", "-c", "find . -name >> '*$sear

[go-nuts] Re: Python cool methods in Golang

2022-08-20 Thread Amnon
Go for it! Write a few methods. Put it on github and post a link here. Best of luck! On Saturday, 20 August 2022 at 11:29:37 UTC+1 harald@gmx.net wrote: > Not showing the code and attaching a (INAL) useless "confidentiality > notice" (good luck arguing with Google over that) looks like a b

[go-nuts] Re: Discussion: standard iterator interface proposal

2022-08-05 Thread Amnon
This is a very good proposal. The use of the range keyword does scare me. But I'll get used to it eventually. And I will need a lot more coffee to get my head around the appendix about coroutine optimisations. But overall this will be a very useful addition which will make a lot of code more con

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread Amnon
Go is designed to maximize throughput, rather than minimize latency. Where does latency come from? 0) serialization delay reading the NIC (packet length/network speed) 1) when a packet arrives the NIC DMA's its contents into memory 2) the NIC then waits to see if more packets arrive (about 60

Re: [go-nuts] Will Go be discontinued?

2022-07-25 Thread Amnon
On Monday, 25 July 2022 at 19:48:24 UTC+1 Carlos Jimenez wrote: > I think it will be discontinued soon > The average lifespan of a discontinued Google product is *4 years and 1 > month*. so should be a matter of months maybe 2.0 will be the last one > before shutdown > The average lifespan ma

[go-nuts] Re: Go build but module-aware mode

2022-07-20 Thread Amnon
I can't. My problem is that I can't access github.com// . Either it does not exist. Or user has made the repo private on Github. [image: Screenshot 2022-07-20 at 15.07.31.png] On Wednesday, 20 July 2022 at 15:04:48 UTC+1 rich...@gmail.com wrote:

[go-nuts] Re: duration^2

2022-07-19 Thread Amnon
On Tuesday, 19 July 2022 at 17:14:19 UTC+1 agra...@googlemail.com wrote: > hello, > i am new to everything is new in programming-heaven. old-c-guy. and i > thought it`s time to learn something most-modern .. > Welcome! Go is a great language for old-c-guys (and girls). Go was, in fact mainly

[go-nuts] Re: Golang API to fetch available versions and release features

2022-06-13 Thread Amnon
does https://go.dev/dl/?mode=json have the info you need? On Monday, 13 June 2022 at 17:08:03 UTC+1 durgasomes...@gmail.com wrote: > Hi Team, > > Can someone help me with below queries. > > 1) Do we have any official Golang/Google API to get latest available > Golang versions both major and m

Re: [go-nuts] Re: Go 1.19 Beta 1 is released

2022-06-12 Thread Amnon
rce.com/c/go/+/355789 -- not mentioned in the > Go 1.19 release notes). > > -Ben > > On Sunday, June 12, 2022 at 9:27:27 AM UTC+12 Ian Lance Taylor wrote: > >> On Sat, Jun 11, 2022 at 12:30 AM Amnon wrote: >> > >> > What are the biggest, and most excit

[go-nuts] Re: Go 1.19 Beta 1 is released

2022-06-11 Thread Amnon
Cool! What are the biggest, and most exciting changes coming in 1.19? On Friday, 10 June 2022 at 18:51:02 UTC+1 anno...@golang.org wrote: > Hello gophers, > > We have just released go1.19beta1, a beta version of Go 1.19. > It is cut from the master branch at the revision tagged go1.19beta1. > >

[go-nuts] Re: Golang and virustotal

2022-05-13 Thread Amnon
My workaround is not to use Windows. And not to use anti-virus programs that thing all Go programs are viruses. On Friday, 13 May 2022 at 16:21:31 UTC+1 drro...@gmail.com wrote: > My work around is to compile using -ldflags="-s -w" > > This has worked for the cases when my files make Windows unh

Re: [go-nuts] Re: 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-10 Thread Amnon
> I'm not sure why w.Write would freeze; is your process starting to swap > and it is not really frozen but just taking a long time? Is it being > killed by the kernel's out-of-memory monitor? In the OP's code, w.Write was writing a large amount of data to a pipe, while nothing was reading from t

Re: [go-nuts] Is there a compiler directive to use the Go version set in go.mod instead of the current toolchain version?

2022-05-09 Thread Amnon
OT, but why do you want to support the Go 1.15 toolchain? 1.15 and 1.16 are no longer supported upstream, so will not get essential security fixes. Why not just ask your users to upgrade to 1.18.1? On Tuesday, 10 May 2022 at 01:24:12 UTC+1 tapi...@gmail.com wrote: > On Tuesday, May 10, 2022 at 1

[go-nuts] Re: How to write 100MB string to STDOUT

2022-05-08 Thread Amnon
_ := ioutil.ReadAll(r) > os.Stdout = tempStdout > > observed := string(out) > > later - testing expected and observed outcome > > > if observed == expected { > t.Fatalf("\n%s, \nwant: %s\n", observed, expected) > } > > On Sunday, May 8, 2022 at 3:24:06 PM UT

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 Amnon
m using OSX. > > The only reasonI need to redirect is to catch the STOUT output in a string > for testing, > It seems Pipe has limited capacity. May be there is another way. > > On Sunday, May 8, 2022 at 8:33:09 PM UTC-7 Amnon wrote: > >> >> Why don't you try

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 Amnon BC
/// > s := ReadWithReadLine(r) > if strings.Contains(s, find) { > w.Write([]byte(s)[:100]) > w.Write([]byte("\n")) > } else { > w.Write([]byte(" \n")) > } > } > --- > On Sunday, May 8, 2022 at 3:21:52 PM UTC-7 Amnon wrote: > >> On S

[go-nuts] Re: How to write 100MB string to STDOUT

2022-05-08 Thread Amnon
How did you reach the conclusion that it is not working? What is your stdout connected to? On Sunday, 8 May 2022 at 22:24:16 UTC+1 Const V wrote: > I'm submitting as a separate post to focus on the following problem I have: > > writing 100MB string to STDOUT > w io.Writer > w.Write([]byte(s)) > >

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 Amnon BC
On Sun, May 8, 2022 at 10:41 PM Const V wrote: > write to stdout is not working for MB long strings > >> >> That is very surprising indeed. How do you reach the conclusion? How can we replicate that failure? -- You received this message because you are subscribed to the Google Groups "golang-n

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-07 Thread Amnon
So you raise a couple of questions: 1) How about handling runes? The nice thing about utf8 is you don't have to care. If you are searching for the word ascii byte 'test', you can simply compare byte by byte - the letter t is represented by 0x74, and this byte in the search buffer can only repr

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-07 Thread Amnon
expensive allocations. On Saturday, 7 May 2022 at 22:53:54 UTC+1 Amnon wrote: > p.s. If you changed the above code to use strings rather than []byte > it would run many times slower due to the cost of allocation. > > On Saturday, 7 May 2022 at 22:49:08 UTC+1 Amnon wrote: > >> How a

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-07 Thread Amnon
p.s. If you changed the above code to use strings rather than []byte it would run many times slower due to the cost of allocation. On Saturday, 7 May 2022 at 22:49:08 UTC+1 Amnon wrote: > How about something like > > func grep(pat []byte, r io.Reader, w io.Writer) error { >

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-07 Thread Amnon
How about something like func grep(pat []byte, r io.Reader, w io.Writer) error { scanner := bufio.NewScanner(r) for scanner.Scan() { if (bytes.Contains(scanner.Bytes(), pat)) { w.Write(scanner.Bytes()) } } return scanner.Err() } and for extra speed, j

[go-nuts] Good overview of Go's design in ACM

2022-04-27 Thread Amnon
https://cacm.acm.org/magazines/2022/5/260357-the-go-programming-language-and-environment/fulltext -- 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+unsu

[go-nuts] Re: net/http: Why not close the conn directly instead of put the conn into a new list?

2022-04-26 Thread Amnon
You can close any idle connection. But when a TCP socket is unused for a while the congestion window is reset, and next time it is used, it will be in slow start mode. So a recently used connection is likely to have a larger window size, and allow faster transmission, than one which has been idle

[go-nuts] Re: [security] Go 1.18.1 and Go 1.17.9 are released

2022-04-12 Thread Amnon
April 2022 at 07:04:19 UTC+1 Amnon wrote: > Thank for the new release... > > I may be looking in the wrong place, but the darwin binaries for 1.18.1 > appear to be missing. > > https://go.dev/doc/install when installing on a mac shows an installer > button labeled "Downlo

[go-nuts] Re: [security] Go 1.18.1 and Go 1.17.9 are released

2022-04-12 Thread Amnon
ives a 404 error. % go install golang.org/dl/go1.18.1@latest % go1.18.1 download fails with go1.18.1: download failed: no binary release of go1.18.1 for darwin/amd64 at https://dl.google.com/go/go1.18.1.darwin-amd64.tar.gz Downloading from source, and running all.bash works fine. Thanks, A

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

2022-04-06 Thread Amnon
Yes, the Go runtime does use epoll internally and schedules gorountines when their data is available. See https://github.com/golang/go/blob/17b2fb1b656a275906b5071c562439d50a27f167/src/runtime/netpoll_epoll.go It does scale nicely and can handle tens of thousands or even hundreds of thousands o

[go-nuts] Re: Convert string to time.Duration

2022-04-03 Thread Amnon
Use time.ParseDuration() https://go.dev/play/p/SWUHBiSpflh On Sunday, 3 April 2022 at 23:48:54 UTC+1 vika...@gmail.com wrote: > I am looking to convert a *string* (say 4) to type *time.Duration*. > > I've looked around but could not find a way to do so. > > // https://go.dev/play/p/EUuDAY-Qx8N >

[go-nuts] Type Hints for Golang

2022-04-01 Thread Amnon
Python has had Type Hints since 2014 (see PEP 484). Isn't it time the Golang Language caught up? I mean, it is 2022 - or to be more precise April 1st 2022... -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and st

[go-nuts] Re: Is it possible to change the existing printline dynamically in golang?

2022-04-01 Thread Amnon
Yes, this is the murky world of ANSI escape codes. Fortunately there are a whole load of libraries which do this for you... Try https://github.com/cheggaaa/pb or https://github.com/schollz/progressbar or github.com/vardius/progress-go On Friday, 1 April 2022 at 13:12:11 UTC+1 yan.z...@gmail.com w

[go-nuts] debug.ReadBuildInfo is info.Main.Version always "(devel)"

2022-03-16 Thread Amnon
I was hoping to use debug.ReadBuildInfo to avoid using ugly --ldflags -X directives to insert the current git version into my runtime. This works as expected for dependencies. But the main module comes out as (devel). Is there a way to use ReadBuildInfo to get the actual tag and has of the main

Re: [go-nuts] Re: New edition of the Go Programming Language comming soon ?

2022-03-14 Thread Amnon BC
Great post, Rob! CS people generally write books for people like themselves and find it hard to put themselves in the position of someone without a CS degree, learning their first programming language. A lot of people are aware of the lack of good beginner material, but few people have the experien

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread Amnon
Use t.TestDir() https://pkg.go.dev/testing#T.TempDir On Wednesday, 23 February 2022 at 14:37:54 UTC mlevi...@gmail.com wrote: > Use absolute paths? Feels like you're trying to bend something very hard > here > > On Wed, Feb 23, 2022 at 2:54 PM Leam Hall wrote: > >> My program uses data and templ

[go-nuts] Re: New edition of the Go Programming Language comming soon ?

2022-02-13 Thread Amnon
I have not heard of any plans to bring out a new edition of the book. But the original 2015 edition is timeless, as it deals with the fundamentals of the language, of why things are the way they are. Yes they have been some additions to the language since 2015, but nothing which invalidates anythi

[go-nuts] Re: Web development with Go

2022-02-07 Thread Amnon
Applications whether single page or multiple pages do need to communicate with some sort of back-end to get their data and perform business logic. They need something to serve their AJAX requests. And Go is a useful language for writing such back-ends. On Monday, 7 February 2022 at 07:54:38 UT

Re: [go-nuts] Slices of pointers or not?

2022-02-05 Thread Amnon
Go runtime is dominated by the costs of allocation and GC. If you return 1 persons, then if we make the (unrealistic) assumption that a Person contains not pointers (strings etc). then returning []Person would require one allocation, whereas returning []*Person would require 10,001. And GC

Re: [go-nuts] Issues when using time.Ticker microsecond duration

2022-02-03 Thread Amnon BC
> From the tests that I have performed, I can see that a Ticker pretty accurately fires at every 1ms interval. It will depend on the load on your machine. As the load on the machine increases, so with the jitter in the tick time. On Thu, Feb 3, 2022 at 1:19 AM Robert Engels wrote: > I am unclea

Re: [go-nuts] Re: Why, oh why, do people do this? Things that annoy me in Go code.

2022-02-01 Thread Amnon
Idiomatic naming in Go is one of the hardest things to communicate. Everyone seems to bring the idioms from previous languages. Dave Cheney writes about "Lengthy bureaucratic names carry a low amount of signal compared to their weight on the page". Identifiers are not sentences or stand alone st

Re: [go-nuts] Issues when using time.Ticker microsecond duration

2022-01-31 Thread Amnon
Irrespective of the language, these sort of delays are always at the mercy of the scheduling jitter of the underlying operating system. The operating system is at liberty to preempt any application at any time, and then resume it some arbitrary time later. If you ask the OS to sleep for 1ms, th

Re: [go-nuts] Why, oh why, do people do this? Things that annoy me in Go code.

2021-12-09 Thread Amnon
Indeed. There are quite a few linters out there which object to good idiomatic code and which would fail the Go Standard Library. And too many people are happy to pollute their codebase with extraneous noise, rather than fixing the linters, or using just using high quality linters (such as go

[go-nuts] Why, oh why, do people do this? Things that annoy me in Go code.

2021-12-09 Thread Amnon
1) Long functions that go on forever and contain long lambdas and 8 levels of indentation. 2) Long variable names. 3) Variable names which include the type of the variable. 4) Packages whose name contain the word '/pkg/' 5) Repos which contain the prefix go- 6) Code where almost every line pr

[go-nuts] Re: Does Location of Variable Declarations Matter?

2021-11-28 Thread Amnon
In K&R C back in the 1970s, you had to declare your local variables at the beginning of a function, before any statements. I think this is the source of the habit of declaring your variables first. Readability is key here. So it makes sense to declare a statement close to where it is first used,

[go-nuts] Re: Mocking requests in Go

2021-11-05 Thread Amnon
Nice post. Good advice. On Friday, 5 November 2021 at 17:08:25 UTC bke...@zushealth.com wrote: > Sharing an interesting post by Zus technologist > Sonya Huang on mocking requests in Go: > > https://www.linkedin.com/feed/update/urn:li:activity:6862376852103798784/ > --

[go-nuts] Re: Help getting database/sql pooling merged

2021-10-30 Thread Amnon
try pinging https://groups.google.com/g/golang-dev On Friday, 29 October 2021 at 23:37:13 UTC+1 Steven Hartland wrote: > Just a quick bump to see if we can get this over the line in time for the > 1.18 release freeze in just a couple of days time? > > On Sat, 23 Oct 2021 at 00:29, Steven Hartlan

Re: [go-nuts] Re: How to negotiate authentication over HTTP ? (the Go way)

2021-10-27 Thread Amnon
The design of the client side of net/http is not great , and requires a lot of boilerplate. I don't know of any approach which is better than your DoHTTPRequestWithAuthenticationHandling (though I would have chosen a very much

golang-nuts@googlegroups.com

2021-10-26 Thread Amnon
Sadly Decode does collect up the entire res.Body into memory. See https://github.com/golang/go/issues/33714 On Tuesday, 26 October 2021 at 15:25:28 UTC+1 RS wrote: > err = json.NewDecoder(res.Body).Decode(&gr) > if err != nil { > log.Println("ERROR:", err) > return > } > > Using json.newdecoder t

Re: [go-nuts] Draining http response bodies

2021-10-08 Thread Amnon
e: > On Oct 7, 2021, at 3:36 AM, Amnon wrote: > > > > Is it necessary for a http client to fully read the http response body? > > > > Opinion on the Go forums seems divided > https://forum.golangbridge.org/t/do-i-need-to-read-the-body-before-close-it/5594 > &g

[go-nuts] Re: Draining http response bodies

2021-10-07 Thread Amnon
Added issue https://github.com/golang/go/issues/48860 On Thursday, 7 October 2021 at 08:36:25 UTC+1 Amnon wrote: > Is it necessary for a http client to fully read the http response body? > > Opinion on the Go forums seems divided > https://forum.golangbridge.org/t/do-i-need-to-r

[go-nuts] Draining http response bodies

2021-10-07 Thread Amnon
Is it necessary for a http client to fully read the http response body? Opinion on the Go forums seems divided https://forum.golangbridge.org/t/do-i-need-to-read-the-body-before-close-it/5594 But a simple benchmark https://play.golang.org/p/5JDWYbRe0lD suggests that leaving unread data in the re

[go-nuts] Better documentation needed on draining http request bodies

2021-10-07 Thread Amnon
Is it necessary to drain a http client to fully read the http response body? Opinion on the Go forums seems divided https://forum.golangbridge.org/t/do-i-need-to-read-the-body-before-close-it/5594 But a simple benchmark https://play.golang.org/p/5JDWYbRe0lD suggests that leaving unread data in

Re: [go-nuts] What is the total max size of embed content?

2021-09-22 Thread Amnon
A cloud DB looks like a great option here. The cost/complication would be trivial compared to the cost/complication fixing the tool chain to handle enormous executables, and of shipping these around. On Tuesday, 21 September 2021 at 20:41:42 UTC+1 glen@gmail.com wrote: > Hello Ian, > > Yes,

[go-nuts] Excellent blog post from Filippo on legacy SSL brokenness and Go 1.17

2021-09-16 Thread Amnon
https://go.dev/blog/tls-cipher-suites In case anyone has not seen it, Filippo has published a blog post which shows how SSL Cypher Suite negotiation is fundamentally broken in the older TLS versions. My understanding of the post is that to run a secure server on the internet, just make sure y

[go-nuts] Re: Logging libraries and standard library compatibility

2021-08-28 Thread Amnon
Yes, this is a massive pain. The standard library's log.Logger is not an interface, despite ending in er. If it was an interface, it would be easy for third party packages to implement it, and then it would be a lowest common denominator for any package where doing some logging could be useful

Re: [go-nuts] Re: Makefiles for Go Programs

2021-08-23 Thread Amnon
I think the basic idea is that Go projects do not have makefiles because they do not need makefiles. Ideally the Go command does the right thing, including fetching and building dependencies, and building entire trees of projects. Go is opinionated, and dictates where each package can be found

[go-nuts] An interesting thread on Python Packing with lots of discussion about Go

2021-08-21 Thread Amnon
https://threadreaderapp.com/thread/1427077655627661315.html -- 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+unsubscr...@googlegroups.com. To view this

[go-nuts] Re: Why isn't go more popular?

2021-08-12 Thread Amnon
I think Go is actually quite popular. Especially with people on this list On Wednesday, 11 August 2021 at 06:45:06 UTC+1 tapi...@gmail.com wrote: > Personally, Go will become more popular if we could develop gfx/gui apps > in Go with ease. > > On Thursday, August 5, 2021 at 10:20:49 PM UTC-4

[go-nuts] Re: Research on Go memory model and race detector

2021-07-08 Thread Amnon
Good luck with your thesis. It is worth looking at Russ Cox's blog, where he is giving Memory models his usual thorough treatment. https://research.swtch.com/mm. I suspect that memory models may be getting increased attention because of the increased usage of Arm processors, with more relaxed

  1   2   3   >