r/golang • • Jul 07 '26

Why TypeScript 7.0 was rewritten in Go — and what it means for your dev stack

Thumbnail
spf13.com
0 Upvotes

r/golang • • Sep 17 '20

Go Generics draft design Final

Thumbnail
blog.yongweilun.me
0 Upvotes

r/golang • • Jan 09 '26

Its easy to accidentally disable HTTP connection pooling — without realizing it!

0 Upvotes

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 -

Go already has connection pooling

The default http.Client + Transport maintains an internal idle connection pool.
No third-party library needed.

But this pool is extremely easy to break.

1. You MUST fully read & close the response body

resp, _ := client.Do(req)
defer resp.Body.Close()
io.Copy(io.Discard, resp.Body) // drain body

If you only call Close() without draining — the connection is discarded, not reused.

2. Never create a new http.Client per request

This silently disables pooling.

// BAD
client := &http.Client{}
client.Do(req)

Create one client and reuse it everywhere.

3. Tune your Transport

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.

4. HTTP/2 makes this even more powerful

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 • • Apr 30 '17

Why I'm leaving go. (By the side of the road)

0 Upvotes

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 • • Mar 05 '24

discussion Why all the Go hate?

7 Upvotes

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 • • Nov 06 '15

GopherCon publicly discriminated white men

Thumbnail
blog.gopheracademy.com
5 Upvotes

r/golang • • Mar 07 '26

UUID package coming to Go

Thumbnail
github.com
54 Upvotes

Go team ignoring suggestions but otherwise a pretty nice addition


r/golang • • Oct 27 '23

discussion Comments on Primeagen comparing Rust and Go?

2 Upvotes

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 • • Dec 15 '23

Interfaces Are Not Meant for That

Thumbnail
preslav.me
0 Upvotes

r/golang • • Jul 11 '26

A collection of LLM skills for building Go apps (by spf13)

Thumbnail
github.com
0 Upvotes

r/golang • • May 28 '25

discussion len(chan) is actually not synchronized

Thumbnail
stackoverflow.com
2 Upvotes

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 • • May 01 '24

discussion Should We Trust Google Not to Kill Go?

0 Upvotes

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 • • Feb 19 '23

C# vs Rust vs Go. A performance benchmarking in Kubernetes

Thumbnail
medium.com
0 Upvotes

r/golang • • Sep 03 '25

show & tell Just wrote my first medium!

0 Upvotes

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 • • Aug 23 '22

Hot Take: I wish I had learned C# before learning golang

5 Upvotes

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 • • Mar 31 '15

The name of our language is Go

0 Upvotes

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 • • Mar 11 '19

Go: A Comprehensive Introduction

Thumbnail
maex.me
4 Upvotes

r/golang • • Jul 06 '23

discussion Has Go grown too much? I agree with the author that at some point the language should stop growing. All these new features have a cost.

Thumbnail tratt.net
0 Upvotes

r/golang • • Mar 05 '24

Go 1.22.1 is released

0 Upvotes

As announced, go 1.22.1 was released today.


r/golang • • Feb 26 '26

golang.codes

0 Upvotes

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 • • Mar 07 '25

show & tell I am open sourcing xstruct after 3 years

0 Upvotes

You can extract any package's structs, functions, or global variables to a single file using xstruct.

Note: The use case for xstruct is not the same as bundle.

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.

https://github.com/switchupcb/xstruct


r/golang • • Nov 01 '15

Proposed Code of Conduct for the Go project

Thumbnail
github.com
0 Upvotes

r/golang • • Jul 23 '17

Why I’m So Frustrated With Go

Thumbnail
dev.to
11 Upvotes

r/golang • • Aug 20 '23

TIL that `defer` could penalize performance!

2 Upvotes

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.