r/golang • u/spf13 • Jul 07 '26
Why TypeScript 7.0 was rewritten in Go — and what it means for your dev stack
r/golang • u/spf13 • Jul 07 '26
r/golang • u/abhishek467267 • Jan 09 '26
While optimizing a service that was making frequent outbound HTTP calls, I initially assumed every request creates a new TCP/TLS connection.
That assumption was wrong.
Go’s net/http client reuses connections by default — but only if you use it correctly.
Here’s what I learned -
The default http.Client + Transport maintains an internal idle connection pool.
No third-party library needed.
But this pool is extremely easy to break.
resp, _ := client.Do(req)
defer resp.Body.Close()
io.Copy(io.Discard, resp.Body) // drain bodyIf you only call Close() without draining — the connection is discarded, not reused.
This silently disables pooling.
// BAD
client := &http.Client{}
client.Do(req)Create one client and reuse it everywhere.
transport := &http.Transport{
MaxIdleConns: 100,
MaxIdleConnsPerHost: 10,
IdleConnTimeout: 90 * time.Second,
}
client := &http.Client{Transport: transport}Defaults are conservative and can throttle throughput under load.
With HTTP/2, a single TCP connection can serve many concurrent requests — but only if reuse isn’t broken.
Interesting read: https://davidbacisin.com/writing/golang-http-connection-pools-1
r/golang • u/readytoruple • Apr 30 '17
Why I'm leaving go.
A preface: I don't expect a single person to agree with me. I don't care.
I hit the ground running with go. Day 1 of the go release was the most amazing programming experience I'd ever had. Years of bouncing between beans and asp.net had convinced me that there had to be a better way. And go was it. I didn't know it at the time, but I was typing out my own eulogy, one line at a time.
I was all-in after I watched a launch video, and by the end of the day I was prototyping replacements for web applications that I'd worked on for years. The native concurrency felt so much more natural than anything I'd worked with, and I'd worked with a lot. Channels felt as simple as pipes. The GC never mattered much as I like to avoid the heap (a habit I'd developed in C) but it was nice. The templates, ah the templates, what you couldn't do with those.
Interfaces were my first roadblock. Why do I need interfaces when function closures are first-class? Whatever, they must know what they're doing. Once I'd wrapped my head around their ins and outs I was fine. But wait, why am I using methods on pointers? And why is type checking separate from type assertion? And where did my memory model go?
Netchan was another, understandable, annoyance. Big promises of inter-machine synchronization ended in tears. Rob Pike wasn't smart enough... Nobody was smart enough to solve it, I'm not convinced there is a solution. I don't blame the man for dreaming. And gob was a masterpiece.
I worked away for years, web apps at first, then middleware and management tools, finally multiplayer game engines. But the entire time I was teaching myself something... bad. I was teaching myself to be lazy. Von Neumann was not perfect, it had it's limitations. Like caching. Oh god.
Carefully hidden behind syntactic sugar and slice operations was an extremely complex relationship between "data" and bits.
The moment the relationship between my data structures and the machine became "abstract" was... not well defined. Very complex IO-driven programs would go from performant to dead when the CPU hit 100%. What was I doing wrong? I'd listened to the lectures, I followed best practices, I wrote "clean code". It started to dawn on me that something was a-miss(pun intended).
No matter how I tried, I couldn't wrangle go's memory management into something sane. Cache misses were dominating everything. I couldn't very well leverage the branch predictor if I couldn't control flow, and in go you can't control flow. Full stop. There is a distinct ambiguity in goroutine scheduling control that lives in a murky world of thread locking and gosched and other voodoo.
Was I expecting too much? Definitely.
Go solves so many of the problems that programmers, and now devops face. Too many to list. But it fails in a major way and when applications grow in scope they start to hog, and wedge, and fail.
What started as using cgo for a few critical paths has lead, ultimately back, to writing IO in C, relegating go to scripting...
...which is where it belongs.
r/golang • u/rretaemer1 • Mar 05 '24
Title is the question more or less. Has anyone else noticed any disdain, lack of regard, or even outright snobbiness towards Go from a lot of developers out there? Curious why this is the case.
Go is a beautiful language imo that makes it easy to actually be productive and collaborative and to get things done. It's as if any simplicity that lends itself to that end in Go gets sneered at by a certain subsect of programmers, like it's somehow cheating, bowling with bumpers, riding a bike with training wheels etc. I don't understand.
r/golang • u/zzoid • Nov 06 '15
r/golang • u/whittileaks • Mar 07 '26
Go team ignoring suggestions but otherwise a pretty nice addition
r/golang • u/gatestone • Oct 27 '23
He thinks Go is better for everything except for simple data pipelines. But he critizises the Go exposure for nil pointer hazard and says the compiler should force you to check, with Rust style result type.
https://www.youtube.com/watch?v=p-tb1ZfkwgQ&ab_channel=ThePrimeTime
r/golang • u/kkajla12 • Jul 11 '26
r/golang • u/SOFe1970 • May 28 '25
Despite the claim in https://go.dev/ref/spec that "channel may be used in... len by any number of goroutines without further synchronization", the actual operation is not synchronized.
r/golang • u/JohnBalvin • May 01 '24
With the recent announcements of Google laying off Python, Flutter, and Dart teams, Python in general is not affected at all because it is not maintained by Google. However, Flutter and Dart are affected, and with Google's reputation for unexpectedly killing it's products like Google Domains and Google Podcasts, it raises concerns.
Should we trust Google not killing Go?
Google lay off products
https://www.reddit.com/r/FlutterDev/comments/1cduhra/more_layoffs_for_the_flutter_team/
Ps:
I mentioned Google Domains and Google podcast because I was actively using them, I know there are more products killed by Google before
I don't use Flutter or Dart at all
r/golang • u/rudrmuu • Feb 19 '23
r/golang • u/Fun_Effect4290 • Sep 03 '25
hey all
i just wrote my first medium blog after a while im planning to do so
i would really appreciate any thought / idea to improve for next time
https://medium.com/@ishaish103/building-bulletproof-leader-election-in-kubernetes-operators-a-deep-dive-4c82879d9d37
r/golang • u/fawkesgambit • Aug 23 '22
GO was my first language to learn (on my own)…now in college I am taking C#. It has made me realize how much golang spoils us with features. It’s ability to assume variable types, ease of type conversions, it’s object oriented nature, ease of placing variables and objects in arrays…it’s amazing.
However, I’m wishing I had learned C# first so that I could have had a better understanding of what was going on behind the scenes in go.
Still new to C# though…maybe I’ll change my mind.
In hindsight,I wish that C# had been my first step.
r/golang • u/[deleted] • Mar 31 '15
Ruby is called Ruby, not Rubylang.
Python is called Python, not Pythonlang.
C is called C, not Clang. No. Wait. That was a bad example.
Go is called Go, not Golang.
Yes, yes, I know all about the searching and meta tags. Sure, whatever, but that doesn't change the fact that the name of the language is Go.
Thank you for your consideration.
r/golang • u/Complex_Inspection47 • Jul 06 '23
r/golang • u/TAAnderson • Mar 05 '24
As announced, go 1.22.1 was released today.
r/golang • u/jojkoJiano • Feb 26 '26
Hey guys! just built this Go learning platform called golang.codes , it an interactive learning platform for Go. Please check it out improve the content the code is here repo.
r/golang • u/SwitchUpCB • Mar 07 '25
You can extract any package's structs, functions, or global variables to a single file using xstruct.
Note: The use case for
xstructis not the same asbundle.
xstruct is used in disgo's generation pipeline — which maintains over 10,000 lines of human readable code — and has saved me time debugging issues in third party software.
So, why am I open sourcing xstruct now?
Here is the story.
3 years ago, I developed a bunch of database schemas for services I wanted to build.
Then what happened?
You can understand how using SQL databases with Go is a huge time sink when
You must develop SQL statements for a table.
You must develop code to call this SQL.
You may want to map this code to domain types.
Then, you must repeat this process for every table update.
So, life happened and I wasn't able to finish my services. Oh no...
Let's fast forward.
My goal now is to release a guide which helps other people survive homelessness as I did. And there is a database service I am developing to speed this process up.
Unfortunately, using a database with Go is still time consuming — even with sqlc and xo — so I am also developing a generator to help you stop wasting time developing type-safe yet performant code for your database.
I'm open sourcing xstruct now because this soon-to-be-released generator is the second tool to use xstruct so I'm positive you have other use cases for the software.
r/golang • u/shahdharmit • Aug 20 '23
I was reading through the code of golang-set and found it unusual that there was barely any use of defer to unlock the mutex in the thread safe implementation. Later I discovered that it was a conscious decision to avoid performance penalty caused by defer (blog is quite old, but there's still some difference in benchmark tests between the code that uses defer and one that doesn't).
Of course, this "penalty" matters only when writing highly performant code. For most cases, using `defer` would still be great to ensure correctness.